Geogram  Version 1.9.1
A programming library of geometric algorithms
GEO::ParamValidator Class Reference

Tests whether texture coordinates attached to a surface mesh define a valid parameterization. More...

#include <geogram/parameterization/mesh_param_validator.h>

Public Member Functions

 ParamValidator ()
 ParamValidator constructor.
 
 ~ParamValidator ()
 ParamValidator destructor.
 
 ParamValidator (const ParamValidator &rhs)=delete
 Forbids copy.
 
ParamValidatoroperator= (const ParamValidator &rhs)=delete
 Forbids copy.
 
bool chart_is_valid (Mesh &chart)
 Tests whether a Mesh and associated texture coordinates defines a valid parameterization. More...
 
double chart_scaling (Mesh &chart)
 Computes the scaling induced by the parameterization. More...
 
void compute_fill_and_overlap_ratio (Mesh &chart)
 Computes the filling and overlapping ratio of a parameterized chart. More...
 
double fill_ratio () const
 Gets the computed filling ratio. More...
 
double overlap_ratio () const
 Gets the computed overlap ratio. More...
 
double get_max_overlap_ratio () const
 Gets the maximum overlapping ratio. More...
 
void set_max_overlap_ratio (double x)
 Sets the maximum overlapping ratio. More...
 
double get_max_scaling () const
 Gets the maximum scaling. More...
 
void set_max_scaling (double x)
 Sets the maximum scaling. More...
 
double get_min_fill_ratio () const
 Gets the minimum filling ratio. More...
 
void set_min_fill_ratio (double x)
 Sets the minimum filling ratio. More...
 
void set_verbose (bool x)
 Enables or disables messages. More...
 

Protected Member Functions

void begin_rasterizer (Mesh &mesh, Attribute< double > &tex_coord)
 Initializes the software rasterizer for a chart. More...
 
void end_rasterizer ()
 Terminates the software rasterizer. More...
 
void rasterize_triangle (const vec2 &p1, const vec2 &p2, const vec2 &p3)
 Rasterizes a triangle. More...
 
void transform (const vec2 &p, int &x, int &y)
 Transforms a 2d point from parameter space to raterizer coordinates. More...
 

Detailed Description

Tests whether texture coordinates attached to a surface mesh define a valid parameterization.

Definition at line 61 of file mesh_param_validator.h.

Member Function Documentation

◆ begin_rasterizer()

void GEO::ParamValidator::begin_rasterizer ( Mesh mesh,
Attribute< double > &  tex_coord 
)
protected

Initializes the software rasterizer for a chart.

Parameters
[in]mesha reference to the chart.
[in]tex_coorda vector attribute of dimension 2 attached to the facet corners of the chart with the texture coordinates.

◆ chart_is_valid()

bool GEO::ParamValidator::chart_is_valid ( Mesh chart)

Tests whether a Mesh and associated texture coordinates defines a valid parameterization.

Parameters
[in]charta reference to the Mesh

The mesh this chart belongs to is supposed to have a 2d vector attribute "tex_coord" attached to the vertices of the mesh with the texture coordinates.

Return values
trueif texture coordinates define a valid parameterization.
falseotherwise.

◆ chart_scaling()

double GEO::ParamValidator::chart_scaling ( Mesh chart)

Computes the scaling induced by the parameterization.

Returns
the ratio between the maximum area scaling and minimum area scaling of the triangles.
Parameters
[in]charta reference to the chart

◆ compute_fill_and_overlap_ratio()

void GEO::ParamValidator::compute_fill_and_overlap_ratio ( Mesh chart)

Computes the filling and overlapping ratio of a parameterized chart.

The filling and overlapping ratio are stored in this ParamValidator and can be subsequently queried with fill_ratio() and overlap_ratio() respectively.

◆ end_rasterizer()

void GEO::ParamValidator::end_rasterizer ( )
protected

Terminates the software rasterizer.

This counts the pixels to evaluate the filling and overlapping ratio.

◆ fill_ratio()

double GEO::ParamValidator::fill_ratio ( ) const
inline

Gets the computed filling ratio.

chart_is_valid() or compute_fill_and_overlap_ration() need to be called before.

Returns
The ratio between the area used by the triangles in parameter space and the total area of the bounding rectangle.

Definition at line 119 of file mesh_param_validator.h.

◆ get_max_overlap_ratio()

double GEO::ParamValidator::get_max_overlap_ratio ( ) const
inline

Gets the maximum overlapping ratio.

If the overlapping ratio is greater than this threshold then chart_is_valid() returns false.

Returns
the maximum ratio between the area that correspond to overlapping triangles in parameter space and the total area of the bounding rectangle.

Definition at line 143 of file mesh_param_validator.h.

◆ get_max_scaling()

double GEO::ParamValidator::get_max_scaling ( ) const
inline

Gets the maximum scaling.

If the scaling is greater than this threshold then chart_is_valid() returns false.

Returns
the maximum scaling between the area of a facet in parameter space and the area of the facet in 3D, relative to the mimium scaling evaluated on all the facets of the mesh.

Definition at line 168 of file mesh_param_validator.h.

◆ get_min_fill_ratio()

double GEO::ParamValidator::get_min_fill_ratio ( ) const
inline

Gets the minimum filling ratio.

If the filling ratio is greater than this threshold then chart_is_valid() returns false.

Returns
the minimum ratio between the area taken by the facets in parameter space and the total area of the bounding rectangle.

Definition at line 191 of file mesh_param_validator.h.

◆ overlap_ratio()

double GEO::ParamValidator::overlap_ratio ( ) const
inline

Gets the computed overlap ratio.

chart_is_valid() or compute_fill_and_overlap_ration() need to be called before.

Returns
The ratio between the area that correspond to overlapping triangles in parameter space and the total area of the bounding rectangle.

Definition at line 131 of file mesh_param_validator.h.

◆ rasterize_triangle()

void GEO::ParamValidator::rasterize_triangle ( const vec2 p1,
const vec2 p2,
const vec2 p3 
)
protected

Rasterizes a triangle.

This updates pixel counts for evaluating the filling and overlapping ratio.

Parameters
[in]p1,p2,p3the 2d coordinates of the vertices of the triangle.

◆ set_max_overlap_ratio()

void GEO::ParamValidator::set_max_overlap_ratio ( double  x)
inline

Sets the maximum overlapping ratio.

Parameters
[in]xthe maximum ratio between the area that correspond to overlapping triangles in parameter space and the total area of the bounding rectangle.

If the overlapping ratio is greater than this threshold then chart_is_valid() returns false.

Definition at line 155 of file mesh_param_validator.h.

◆ set_max_scaling()

void GEO::ParamValidator::set_max_scaling ( double  x)
inline

Sets the maximum scaling.

If the scaling is greater than this threshold then chart_is_valid() returns false.

Parameters
[in]xthe maximum scaling between the area of a facet in parameter space and the area of the facet in 3D, relative to the mimium scaling evaluated on all the facets of the mesh.

Definition at line 180 of file mesh_param_validator.h.

◆ set_min_fill_ratio()

void GEO::ParamValidator::set_min_fill_ratio ( double  x)
inline

Sets the minimum filling ratio.

If the filling ratio is greater than this threshold then chart_is_valid() returns false.

Parameters
[in]xthe minimum ratio between the area taken by the facets in parameter space and the total area of the bounding rectangle.

Definition at line 204 of file mesh_param_validator.h.

◆ set_verbose()

void GEO::ParamValidator::set_verbose ( bool  x)
inline

Enables or disables messages.

Parameters
[in]xif true, messages are displayed on the console with charts statistics. Default is non-verbose.

Definition at line 213 of file mesh_param_validator.h.

◆ transform()

void GEO::ParamValidator::transform ( const vec2 p,
int &  x,
int &  y 
)
protected

Transforms a 2d point from parameter space to raterizer coordinates.

Parameters
[in]pthe parameter-space 2d coordinates of the point.
[out]x,ythe integer rasterizer-space coordinates.

The documentation for this class was generated from the following file: