\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 5.0.1 - Polygon Mesh Processing

Functions to compute the distance between meshes, between a mesh and a point set and between a point set and a mesh.

Functions

template<class OutputIterator , class TriangleMesh , class NamedParameters >
OutputIterator CGAL::Polygon_mesh_processing::sample_triangle_mesh (const TriangleMesh &tm, OutputIterator out, NamedParameters np)
 generates points taken on tm and outputs them to out, the sampling method is selected using named parameters. More...
 
template<class Concurrency_tag , class TriangleMesh , class NamedParameters1 , class NamedParameters2 >
double CGAL::Polygon_mesh_processing::approximate_Hausdorff_distance (const TriangleMesh &tm1, const TriangleMesh &tm2, const NamedParameters1 &np1, const NamedParameters2 &np2)
 computes the approximate Hausdorff distance from tm1 to tm2 by returning the distance of the farthest point from tm2 amongst a sampling of tm1 generated with the function sample_triangle_mesh() with tm1 and np1 as parameter. More...
 
template<class Concurrency_tag , class TriangleMesh , class NamedParameters1 , class NamedParameters2 >
double CGAL::Polygon_mesh_processing::approximate_symmetric_Hausdorff_distance (const TriangleMesh &tm1, const TriangleMesh &tm2, const NamedParameters1 &np1, const NamedParameters2 &np2)
 computes the approximate symmetric Hausdorff distance between tm1 and tm2. More...
 
template<class Concurrency_tag , class TriangleMesh , class PointRange , class NamedParameters >
double CGAL::Polygon_mesh_processing::max_distance_to_triangle_mesh (const PointRange &points, const TriangleMesh &tm, const NamedParameters &np)
 returns the distance to tm of the point from points that is the furthest from tm. More...
 
template<class TriangleMesh , class PointRange , class NamedParameters >
double CGAL::Polygon_mesh_processing::approximate_max_distance_to_point_set (const TriangleMesh &tm, const PointRange &points, const double precision, const NamedParameters &np)
 returns an approximation of the distance between points and the point lying on tm that is the farthest from points More...
 

Function Documentation

◆ approximate_Hausdorff_distance()

template<class Concurrency_tag , class TriangleMesh , class NamedParameters1 , class NamedParameters2 >
double CGAL::Polygon_mesh_processing::approximate_Hausdorff_distance ( const TriangleMesh &  tm1,
const TriangleMesh &  tm2,
const NamedParameters1 &  np1,
const NamedParameters2 &  np2 
)

#include <CGAL/Polygon_mesh_processing/distance.h>

computes the approximate Hausdorff distance from tm1 to tm2 by returning the distance of the farthest point from tm2 amongst a sampling of tm1 generated with the function sample_triangle_mesh() with tm1 and np1 as parameter.

A parallel version is provided and requires the executable to be linked against the Intel TBB library. To control the number of threads used, the user may use the tbb::task_scheduler_init class. See the TBB documentation for more details.

Template Parameters
Concurrency_tagenables sequential versus parallel algorithm. Possible values are Sequential_tag and Parallel_tag.
TriangleMesha model of the concept FaceListGraph
NamedParameters1a sequence of Named Parameters for tm1
NamedParameters2a sequence of Named Parameters for tm2
Parameters
tm1the triangle mesh that will be sampled
tm2the triangle mesh to compute the distance to
np1optional sequence of Named Parameters for tm1 passed to sample_triangle_mesh().
np2optional sequence of Named Parameters for tm2 among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm2 If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available in TriangleMesh and in all places where vertex_point_map is used.

The function CGAL::parameters::all_default() can be used to indicate to use the default values for np1 and specify custom values for np2

Examples:
Polygon_mesh_processing/hausdorff_distance_remeshing_example.cpp.

◆ approximate_max_distance_to_point_set()

template<class TriangleMesh , class PointRange , class NamedParameters >
double CGAL::Polygon_mesh_processing::approximate_max_distance_to_point_set ( const TriangleMesh &  tm,
const PointRange &  points,
const double  precision,
const NamedParameters &  np 
)

#include <CGAL/Polygon_mesh_processing/distance.h>

returns an approximation of the distance between points and the point lying on tm that is the farthest from points

Template Parameters
PointRangea range of Point_3, model of Range.
TriangleMesha model of the concept FaceListGraph
NamedParametersa sequence of Named Parameters
Parameters
tma triangle mesh
pointsa range of points
precisionfor each triangle of tm, the distance of its farthest point from points is bounded. A triangle is subdivided into sub-triangles so that the difference of its distance bounds is smaller than precision. precision must be strictly positive to avoid infinite loops.
npan optional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm. If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available for the vertices of tm
geom_traitsan instance of a geometric traits class, model of PMPDistanceTraits.
Examples:
Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp.

◆ approximate_symmetric_Hausdorff_distance()

template<class Concurrency_tag , class TriangleMesh , class NamedParameters1 , class NamedParameters2 >
double CGAL::Polygon_mesh_processing::approximate_symmetric_Hausdorff_distance ( const TriangleMesh &  tm1,
const TriangleMesh &  tm2,
const NamedParameters1 &  np1,
const NamedParameters2 &  np2 
)

#include <CGAL/Polygon_mesh_processing/distance.h>

computes the approximate symmetric Hausdorff distance between tm1 and tm2.

It returns the maximum of approximate_Hausdorff_distance(tm1, tm2, np1, np2) and approximate_Hausdorff_distance(tm2, tm1, np2, np1).

◆ max_distance_to_triangle_mesh()

template<class Concurrency_tag , class TriangleMesh , class PointRange , class NamedParameters >
double CGAL::Polygon_mesh_processing::max_distance_to_triangle_mesh ( const PointRange &  points,
const TriangleMesh &  tm,
const NamedParameters &  np 
)

#include <CGAL/Polygon_mesh_processing/distance.h>

returns the distance to tm of the point from points that is the furthest from tm.

Template Parameters
PointRangea range of Point_3, model of Range. Its iterator type is RandomAccessIterator.
TriangleMesha model of the concept FaceListGraph
NamedParametersa sequence of Named Parameters
Parameters
pointsthe range of points of interest
tmthe triangle mesh to compute the distance to
npan optional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm. If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available for the vertices of tm
geom_traitsan instance of a geometric traits class, model of PMPDistanceTraits

◆ sample_triangle_mesh()

template<class OutputIterator , class TriangleMesh , class NamedParameters >
OutputIterator CGAL::Polygon_mesh_processing::sample_triangle_mesh ( const TriangleMesh &  tm,
OutputIterator  out,
NamedParameters  np 
)

#include <CGAL/Polygon_mesh_processing/distance.h>

generates points taken on tm and outputs them to out, the sampling method is selected using named parameters.

Template Parameters
TriangleMesha model of the concept FaceListGraph
OutputIteratora model of OutputIterator holding objects of the same point type as the value type of the internal vertex point map of tm
Parameters
tmthe triangle mesh that will be sampled
outoutput iterator to be filled with sampled points
npan optional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of tm. If this parameter is omitted, an internal property map for CGAL::vertex_point_t must be available for TriangleMesh.
geom_traitsa model of PMPDistanceTraits.
use_random_uniform_samplingif true is passed (the default), points are generated in a random and uniform way on the surface of tm, and/or on edges of tm. For faces, the number of sample points is the value passed to the named parameter number_of_points_on_faces(). If not set, the value passed to the named parameter number_of_points_per_area_unit() is multiplied by the area of tm to get the number of sample points. If none of these parameters is set, the number of points sampled is num_vertices(tm). For edges, the number of the number of sample points is the value passed to the named parameter number_of_points_on_edges(). If not set, the value passed to the named parameter number_of_points_per_distance_unit() is multiplied by the sum of the length of edges of tm to get the number of sample points. If none of these parameters is set, the number of points sampled is num_vertices(tm).
use_grid_samplingif true is passed, points are generated on a grid in each triangle, with a minimum of one point per triangle. The distance between two consecutive points in the grid is that of the length of the smallest non-null edge of tm or the value passed to the named parameter grid_spacing(). Edges are also split using the same distance, if requested.
use_monte_carlo_samplingif true is passed, points are generated randomly in each triangle and/or on each edge. For faces, the number of points per triangle is the value passed to the named parameter number_of_points_per_face(). If not set, the value passed to the named parameter number_of_points_per_area_unit() is used to pick a number of points per face proportional to the triangle area with a minimum of one point per face. If none of these parameters is set, 2 divided by the square of the length of the smallest non-null edge of tm is used as if it was passed to number_of_points_per_area_unit(). For edges, the number of points per edge is the value passed to the named parameter number_of_points_per_edge(). If not set, the value passed to the named parameter number_of_points_per_distance_unit() is used to pick a number of points per edge proportional to the length of the edge with a minimum of one point per face. If none of these parameters is set, 1 divided by the length of the smallest non-null edge of tm is used as if it was passed to number_of_points_per_distance_unit().
sample_verticesif true is passed (default value), vertices of tm are put into out.
sample_edgesif true is passed (default value), edges of tm are sampled.
sample_facesif true is passed (default value), faces of tm are sampled.
grid_spacinga double value used as the grid spacing for the grid sampling method.
number_of_points_on_edgesan unsigned integral value used for the random sampling method as the number of points to pick exclusively on edges.
number_of_points_on_facesan unsigned integral value used for the random sampling method as the number of points to pick on the surface.
number_of_points_per_distance_unita double value used for the random sampling and the Monte Carlo sampling methods to repectively determine the total number of points on edges and the number of points per edge.
number_of_points_per_edgean unsigned integral value used by the Monte-Carlo sampling method as the number of points per edge to pick.
number_of_points_per_facean unsigned integral value used by the Monte-Carlo sampling method as the number of points per face to pick.
number_of_points_per_area_unita double value used for the random sampling and the Monte Carlo sampling methods to repectively determine the total number of points inside faces and the number of points per face.