\( \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 - Polygon Mesh Processing

Functions to compute or change the orientation of faces and surfaces.

Functions

template<class PointRange , class PolygonRange >
bool CGAL::Polygon_mesh_processing::orient_polygon_soup (PointRange &points, PolygonRange &polygons)
 tries to consistently orient a soup of polygons in 3D space. More...
 
template<typename PolygonMesh , typename NamedParameters >
bool CGAL::Polygon_mesh_processing::is_outward_oriented (const PolygonMesh &pmesh, const NamedParameters &np)
 tests whether a closed polygon mesh has a positive orientation. More...
 
template<typename PolygonMesh >
void CGAL::Polygon_mesh_processing::reverse_face_orientations (PolygonMesh &pmesh)
 reverses for each face the order of the vertices along the face boundary. More...
 
template<typename PolygonMesh , typename FaceRange >
void CGAL::Polygon_mesh_processing::reverse_face_orientations (const FaceRange &face_range, PolygonMesh &pmesh)
 reverses for each face in face_range the order of the vertices along the face boundary. More...
 
template<class TriangleMesh , class NamedParameters >
void CGAL::Polygon_mesh_processing::orient (TriangleMesh &tm, const NamedParameters &np)
 makes each connected component of a closed triangulated surface mesh inward or outward oriented. More...
 
template<class TriangleMesh , class NamedParameters >
void CGAL::Polygon_mesh_processing::orient_to_bound_a_volume (TriangleMesh &tm, const NamedParameters &np)
 orients the connected components of tm to make it bound a volume. More...
 

Function Documentation

◆ is_outward_oriented()

template<typename PolygonMesh , typename NamedParameters >
bool CGAL::Polygon_mesh_processing::is_outward_oriented ( const PolygonMesh &  pmesh,
const NamedParameters &  np 
)

#include <CGAL/Polygon_mesh_processing/orientation.h>

tests whether a closed polygon mesh has a positive orientation.

A closed polygon mesh is considered to have a positive orientation if the normal vectors to all its faces point outside the domain bounded by the polygon mesh. The normal vector to each face is chosen pointing on the side of the face where its sequence of vertices is seen counterclockwise.

Precondition
CGAL::is_closed(pmesh)
If pmesh contains several connected components, they are oriented consistently. In other words, the answer to this predicate would be the same for each isolated connected component.
Template Parameters
PolygonMesha model of FaceListGraph
NamedParametersa sequence of Named Parameters
Parameters
pmeshthe closed polygon mesh to be tested
npoptional sequence of Named Parameters among the ones listed below
Named Parameters
vertex_point_mapthe property map with the points associated to the vertices of pmesh
geom_traitsa geometric traits class instance
See also
CGAL::Polygon_mesh_processing::reverse_face_orientations()

◆ orient()

template<class TriangleMesh , class NamedParameters >
void CGAL::Polygon_mesh_processing::orient ( TriangleMesh &  tm,
const NamedParameters &  np 
)

#include <CGAL/Polygon_mesh_processing/orientation.h>

makes each connected component of a closed triangulated surface mesh inward or outward oriented.

Template Parameters
TriangleMesha model of FaceListGraph and MutableFaceGraph . If TriangleMesh has an internal property map for CGAL::face_index_t, as a named parameter, then it must be initialized.
NamedParametersa sequence of Named Parameters for Polygon Mesh Processing
Parameters
tma closed triangulated surface mesh
npoptional sequence of Named Parameters for Polygon Mesh Processing 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 in TriangleMesh
face_index_mapa property map containing the index of each face of tm.
outward_orientationif set to true (default) indicates that each connected component will be outward oriented, (inward oriented if false).

◆ orient_polygon_soup()

template<class PointRange , class PolygonRange >
bool CGAL::Polygon_mesh_processing::orient_polygon_soup ( PointRange &  points,
PolygonRange &  polygons 
)

#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>

tries to consistently orient a soup of polygons in 3D space.

When it is not possible to produce a combinatorial manifold surface, some points are duplicated. Because a polygon soup does not have any connectivity (each point has as many occurrences as the number of polygons it belongs to), duplicating one point (or a pair of points) amounts to duplicate the polygon to which it belongs.

These points are either an endpoint of an edge incident to more than two polygons, an endpoint of an edge between two polygons with incompatible orientations (during the re-orientation process), or more generally a point p at which the intersection of an infinitesimally small ball centered at p with the polygons incident to it is not a topological disk.

The algorithm is described in [1].

Template Parameters
PointRangea model of the concepts RandomAccessContainer and BackInsertionSequence whose value type is the point type.
PolygonRangea model of the concept RandomAccessContainer whose value_type is a model of the concept RandomAccessContainer whose value_type is std::size_t.
Parameters
pointspoints of the soup of polygons. Some additional points might be pushed back to resolve non-manifoldness or non-orientability issues.
polygonseach element in the vector describes a polygon using the index of the points in points. If needed the order of the indices of a polygon might be reversed.
Returns
true if the orientation operation succeded.
false if some points were duplicated, thus producing a self-intersecting polyhedron.
Examples:
Polygon_mesh_processing/orient_polygon_soup_example.cpp, and Polygon_mesh_processing/repair_polygon_soup_example.cpp.

◆ orient_to_bound_a_volume()

template<class TriangleMesh , class NamedParameters >
void CGAL::Polygon_mesh_processing::orient_to_bound_a_volume ( TriangleMesh &  tm,
const NamedParameters &  np 
)

#include <CGAL/Polygon_mesh_processing/orientation.h>

orients the connected components of tm to make it bound a volume.

See Definitions for a precise definition.

Template Parameters
TriangleMesha model of MutableFaceGraph, HalfedgeListGraph and FaceListGraph. If TriangleMesh has an internal property map for CGAL::face_index_t, as a named parameter, then it must be initialized.
NamedParametersa sequence of Named Parameters for Polygon Mesh Processing
Parameters
tma closed triangulated surface mesh
npoptional sequence of Named Parameters for Polygon Mesh Processing 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 in TriangleMesh
face_index_mapa property map containing the index of each face of tm.
outward_orientationif set to true (default) the outer connected components will be outward oriented (inward oriented if set to false). If the outer connected components are inward oriented, it means that the infinity will be considered as part of the volume bounded by tm.
See also
CGAL::Polygon_mesh_processing::does_bound_a_volume()
Examples:
Polygon_mesh_processing/orient_polygon_soup_example.cpp.

◆ reverse_face_orientations() [1/2]

template<typename PolygonMesh >
void CGAL::Polygon_mesh_processing::reverse_face_orientations ( PolygonMesh &  pmesh)

#include <CGAL/Polygon_mesh_processing/orientation.h>

reverses for each face the order of the vertices along the face boundary.

Template Parameters
PolygonMesha model of FaceListGraph and MutableFaceGraph
Examples:
Polygon_mesh_processing/orient_polygon_soup_example.cpp.

◆ reverse_face_orientations() [2/2]

template<typename PolygonMesh , typename FaceRange >
void CGAL::Polygon_mesh_processing::reverse_face_orientations ( const FaceRange &  face_range,
PolygonMesh &  pmesh 
)

#include <CGAL/Polygon_mesh_processing/orientation.h>

reverses for each face in face_range the order of the vertices along the face boundary.

The function does not perform any control and if the orientation change of the faces makes the polygon mesh invalid, the behavior is undefined.

Template Parameters
PolygonMesha model of FaceListGraph and MutableFaceGraph
FaceRangerange of face descriptors, model of Range. Its iterator type is InputIterator.