CGAL 5.6 - Polygon Mesh Processing
Loading...
Searching...
No Matches
Geometric Measure Functions

Functions to compute lengths of edges and borders, areas of faces and patches, as well as volumes of closed meshes.

Functions

template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::edge_length (typename boost::graph_traits< PolygonMesh >::halfedge_descriptor h, const PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
 computes the length of an edge of a given polygon mesh.
 
template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::squared_edge_length (typename boost::graph_traits< PolygonMesh >::halfedge_descriptor h, const PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
 computes the squared length of an edge of a given polygon mesh.
 
template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::face_border_length (typename boost::graph_traits< PolygonMesh >::halfedge_descriptor h, const PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
 computes the length of the border polyline that contains a given halfedge.
 
template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
std::pair< halfedge_descriptor, FT > CGAL::Polygon_mesh_processing::longest_border (const PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
 finds the longest border of a given triangulated surface and returns a halfedge that is part of this border as well as the length of this border.
 
template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::face_area (typename boost::graph_traits< TriangleMesh >::face_descriptor f, const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 computes the area of a face of a given triangulated surface mesh.
 
template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::squared_face_area (typename boost::graph_traits< TriangleMesh >::face_descriptor f, const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 computes the squared area of a face of a given triangulated surface mesh.
 
template<typename FaceRange , typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::area (FaceRange face_range, const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 computes the area of a range of faces of a given triangulated surface mesh.
 
template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::area (const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 computes the surface area of a triangulated surface mesh.
 
template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::volume (const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 computes the volume of the domain bounded by a closed triangulated surface mesh.
 
template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::face_aspect_ratio (typename boost::graph_traits< TriangleMesh >::face_descriptor f, const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 computes the aspect ratio of a face of a given triangulated surface mesh.
 
template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
Point_3 CGAL::Polygon_mesh_processing::centroid (const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
 computes the centroid of a volume bounded by a closed triangulated surface mesh.
 
template<typename PolygonMesh1 , typename PolygonMesh2 , typename FacePairOutputIterator , typename FaceOutputIterator1 , typename FaceOutputIterator2 , typename NamedParameters1 = parameters::Default_named_parameters, typename NamedParameters2 = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::match_faces (const PolygonMesh1 &m1, const PolygonMesh2 &m2, FacePairOutputIterator common, FaceOutputIterator1 m1_only, FaceOutputIterator2 m2_only, const NamedParameters1 &np1=parameters::default_values(), const NamedParameters2 &np2=parameters::default_values())
 identifies faces only present in m1 and m2 as well as the faces present in both polygon meshes.
 

Function Documentation

◆ area() [1/2]

template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::area ( const TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the surface area of a triangulated surface mesh.

Template Parameters
TriangleMesha model of FaceGraph
NamedParametersa sequence of Named Parameters
Parameters
tmeshthe triangulated surface mesh
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Returns
the surface area of tmesh. The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of tmesh.
Warning
This function involves a square root computation. If Kernel::FT does not support the sqrt() operation, the square root computation will be performed approximately.
See also
face_area()

◆ area() [2/2]

template<typename FaceRange , typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::area ( FaceRange  face_range,
const TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the area of a range of faces of a given triangulated surface mesh.

Template Parameters
FaceRangerange of boost::graph_traits<PolygonMesh>::face_descriptor, model of Range. Its iterator type is InputIterator.
TriangleMesha model of FaceGraph
NamedParametersa sequence of Named Parameters
Parameters
face_rangethe range of faces of whose area is computed
tmeshthe triangulated surface mesh to which the faces of face_range belong
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Returns
sum of face areas of faces. The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of tmesh.
Warning
This function involves a square root computation. If Kernel::FT does not support the sqrt() operation, the square root computation will be performed approximately.
See also
face_area()

◆ centroid()

template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
Point_3 CGAL::Polygon_mesh_processing::centroid ( const TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the centroid of a volume bounded by a closed triangulated surface mesh.

Template Parameters
TriangleMesha model of FaceListGraph
NamedParametersa sequence of Named Parameters
Parameters
tmeshthe closed triangulated surface mesh bounding the volume
npan optional sequence of Named Parameters among the ones listed below
Precondition
tmesh is closed
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Returns
the centroid of the domain bounded by tmesh.

◆ edge_length()

template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::edge_length ( typename boost::graph_traits< PolygonMesh >::halfedge_descriptor  h,
const PolygonMesh &  pmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the length of an edge of a given polygon mesh.

The edge is given by one of its halfedges, or the edge itself.

Template Parameters
PolygonMesha model of HalfedgeGraph
NamedParametersa sequence of Named Parameters
Parameters
hone halfedge of the edge whose length is computed
pmeshthe polygon mesh to which h belongs
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of pmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, pmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Returns
the length of h. The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of pmesh.
Warning
This function involves a square root computation. If FT does not support the sqrt() operation, the square root computation will be performed approximately.
See also
squared_edge_length()
face_border_length()

◆ face_area()

template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::face_area ( typename boost::graph_traits< TriangleMesh >::face_descriptor  f,
const TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the area of a face of a given triangulated surface mesh.

Template Parameters
TriangleMesha model of FaceGraph
NamedParametersa sequence of Named Parameters
Parameters
fthe face whose area is computed
tmeshthe triangulated surface mesh to which f belongs
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Precondition
f != boost::graph_traits<TriangleMesh>::null_face()
Returns
the area of f. The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of tmesh.
Warning
This function involves a square root computation. If Kernel::FT does not support the sqrt() operation, the square root computation will be performed approximately.
See also
squared_face_area()
area()

◆ face_aspect_ratio()

template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::face_aspect_ratio ( typename boost::graph_traits< TriangleMesh >::face_descriptor  f,
const TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the aspect ratio of a face of a given triangulated surface mesh.

Template Parameters
TriangleMesha model of HalfedgeGraph
NamedParametersa sequence of Named Parameters
Parameters
fthe face whose aspect ratio is computed
tmeshthe triangulated surface mesh to which f belongs
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Precondition
f != boost::graph_traits<TriangleMesh>::null_face()
Returns
the aspect ratio of f. The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of tmesh.
Warning
This function involves a square root computation. If Kernel::FT does not support the sqrt() operation, the square root computation will be performed approximately.

◆ face_border_length()

template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::face_border_length ( typename boost::graph_traits< PolygonMesh >::halfedge_descriptor  h,
const PolygonMesh &  pmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the length of the border polyline that contains a given halfedge.

Template Parameters
PolygonMesha model of HalfedgeGraph
NamedParametersa sequence of Named Parameters
Parameters
ha halfedge of the border polyline whose length is computed
pmeshthe polygon mesh to which h belongs
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of pmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, pmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Returns
the length of the sequence of border edges of face(h, pmesh). The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of pmesh.
Warning
This function involves a square root computation. If Kernel::FT does not support the sqrt() operation, the square root computation will be performed approximately.
See also
edge_length()

◆ longest_border()

template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
std::pair< halfedge_descriptor, FT > CGAL::Polygon_mesh_processing::longest_border ( const PolygonMesh &  pmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

finds the longest border of a given triangulated surface and returns a halfedge that is part of this border as well as the length of this border.

Template Parameters
PolygonMesha model of HalfedgeGraph
NamedParametersa sequence of Named Parameters
Parameters
pmeshthe polygon mesh
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of pmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, pmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Returns
a pair composed of two members:
  • first: a halfedge on the longest border. The return type halfedge_descriptor is a halfedge descriptor. It is deduced from the graph traits corresponding to the type PolygonMesh. first is among the halfedges reported by extract_boundary_cycles().
  • second: the length of the longest border The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of pmesh
Warning
This function involves a square root computation. If Kernel::FT does not support the sqrt() operation, the square root computation will be performed approximately.
See also
face_border_length()
extract_boundary_cycles()

◆ match_faces()

template<typename PolygonMesh1 , typename PolygonMesh2 , typename FacePairOutputIterator , typename FaceOutputIterator1 , typename FaceOutputIterator2 , typename NamedParameters1 = parameters::Default_named_parameters, typename NamedParameters2 = parameters::Default_named_parameters>
void CGAL::Polygon_mesh_processing::match_faces ( const PolygonMesh1 &  m1,
const PolygonMesh2 &  m2,
FacePairOutputIterator  common,
FaceOutputIterator1  m1_only,
FaceOutputIterator2  m2_only,
const NamedParameters1 &  np1 = parameters::default_values(),
const NamedParameters2 &  np2 = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

identifies faces only present in m1 and m2 as well as the faces present in both polygon meshes.

Two faces are matching if they have the same orientation and the same points.

Template Parameters
PolygonMesh1a model of HalfedgeListGraph and FaceListGraph
PolygonMesh2a model of HalfedgeListGraph and FaceListGraph
FaceOutputIterator1model of OutputIterator holding boost::graph_traits<PolygonMesh1>::face_descriptor.
FaceOutputIterator2model of OutputIterator holding boost::graph_traits<PolygonMesh2>::face_descriptor.
FacePairOutputIteratormodel of OutputIterator holding std::pair<boost::graph_traits<PolygonMesh1>::face_descriptor, boost::graph_traits<PolygonMesh2>::face_descriptor.
NamedParameters1a sequence of Named Parameters
NamedParameters2a sequence of Named Parameters
Parameters
m1the first polygon mesh
m2the second polygon mesh
commonoutput iterator collecting the faces that are common to both meshes
m1_onlyoutput iterator collecting the faces that are only in m1
m2_onlyoutput iterator collecting the faces that are only in m2
np1an optional sequence of Named Parameters among the ones listed below
np2an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of m1
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh1>::vertex_descriptor as key type and Point_3 as value type. Point_3 must be LessThanComparable.
  • Default: boost::get(CGAL::vertex_point, m1)
  • Extra: The same holds for m2 and PolygonMesh2 and the point type must be the same for both meshes.

  • a property map associating to each vertex of m1 a unique index between 0 and num_vertices(m1) - 1, and similarly for m2.
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<Graph>::vertex_descriptor as key type and std::size_t as value type
  • Default: an automatically indexed internal map
  • Extra: If this parameter is not passed, internal machinery will create and initialize a face index property map, either using the internal property map if it exists or using an external map. The latter might result in - slightly - worsened performance in case of non-constant complexity for index access. The same holds for m2 and PolygonMesh2.

◆ squared_edge_length()

template<typename PolygonMesh , typename NamedParameters = parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::squared_edge_length ( typename boost::graph_traits< PolygonMesh >::halfedge_descriptor  h,
const PolygonMesh &  pmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the squared length of an edge of a given polygon mesh.

The edge is given by one of its halfedges, or the edge itself.

Template Parameters
PolygonMesha model of HalfedgeGraph
NamedParametersa sequence of Named Parameters
Parameters
hone halfedge of the edge whose squared length is computed
pmeshthe polygon mesh to which h belongs
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of pmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, pmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Returns
the squared length of h. The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of pmesh.
See also
edge_length()
face_border_length()

◆ squared_face_area()

template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::squared_face_area ( typename boost::graph_traits< TriangleMesh >::face_descriptor  f,
const TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the squared area of a face of a given triangulated surface mesh.

Template Parameters
TriangleMesha model of FaceGraph
NamedParametersa sequence of Named Parameters
Parameters
fthe face whose squared area is computed
tmeshthe triangulated surface mesh to which f belongs
npan optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Precondition
f != boost::graph_traits<TriangleMesh>::null_face()
Returns
the squared area of f. The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of tmesh.
See also
face_area()

◆ volume()

template<typename TriangleMesh , typename NamedParameters = CGAL::parameters::Default_named_parameters>
FT CGAL::Polygon_mesh_processing::volume ( const TriangleMesh &  tmesh,
const NamedParameters &  np = parameters::default_values() 
)

#include <CGAL/Polygon_mesh_processing/measure.h>

computes the volume of the domain bounded by a closed triangulated surface mesh.

Template Parameters
TriangleMesha model of HalfedgeGraph
NamedParametersa sequence of Named Parameters
Parameters
tmeshthe closed triangulated surface mesh bounding the volume
npan optional sequence of Named Parameters among the ones listed below
Precondition
tmesh is closed
Optional Named Parameters
  • a property map associating points to the vertices of tmesh
  • Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::vertex_descriptor as key type and Point_3 as value type
  • Default: boost::get(CGAL::vertex_point, tmesh)

  • an instance of a geometric traits class
  • Type: a class model of Kernel
  • Default: a CGAL Kernel deduced from the point type, using CGAL::Kernel_traits
  • Extra: The geometric traits class must be compatible with the vertex point type.
Returns
the volume bounded by tmesh. The return type FT is a number type either deduced from the geom_traits Named Parameters if provided, or the geometric traits class deduced from the point property map of tmesh.