Functions to compute or change the orientation of faces and surfaces.
|
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<class PointRange , class PolygonRange > |
bool | CGAL::Polygon_mesh_processing::duplicate_non_manifold_edges_in_polygon_soup (PointRange &points, PolygonRange &polygons) |
| duplicates each 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. More...
|
|
template<class Concurrency_tag = Sequential_tag, class PointRange , class TriangleRange , class TriangleMesh , class NamedParameters > |
void | CGAL::Polygon_mesh_processing::orient_triangle_soup_with_reference_triangle_mesh (const TriangleMesh &tm_ref, PointRange &points, TriangleRange &triangles, const NamedParameters &np) |
| orients each triangle of a triangle soup using the orientation of its closest non degenerate triangle in tm_ref . More...
|
|
template<typename TriangleMesh , typename NamedParameters > |
bool | CGAL::Polygon_mesh_processing::is_outward_oriented (const TriangleMesh &tm, const NamedParameters &np) |
| tests whether a closed triangle 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 VolumeFaceIndexMap , class NamedParameters > |
std::size_t | CGAL::Polygon_mesh_processing::volume_connected_components (const TriangleMesh &tm, VolumeFaceIndexMap volume_id_map, const NamedParameters &np) |
| assigns to each face of tm an id corresponding to the volume connected component it contributes to. More...
|
|
template<class TriangleMesh , class NamedParameters > |
bool | CGAL::Polygon_mesh_processing::does_bound_a_volume (const TriangleMesh &tm, const NamedParameters &np) |
| indicates if tm bounds a volume. 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...
|
|
template<class PolygonMesh , class NamedParameters > |
void | CGAL::Polygon_mesh_processing::merge_reversible_connected_components (PolygonMesh &pm, const NamedParameters &np) |
| reverses the connected components of tm having compatible boundary cycles that could be merged if their orientation were made compatible, and stitches them. More...
|
|
template<typename TriangleMesh , typename NamedParameters >
bool CGAL::Polygon_mesh_processing::is_outward_oriented |
( |
const TriangleMesh & |
tm, |
|
|
const NamedParameters & |
np |
|
) |
| |
#include <CGAL/Polygon_mesh_processing/orientation.h>
tests whether a closed triangle mesh has a positive orientation.
A closed triangle mesh is considered to have a positive orientation if the normal vectors to all its faces point outside the domain bounded by the triangle 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(tm)
-
CGAL::is_triangle_mesh(tm)
-
If
tm
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
-
- Parameters
-
tm | the closed triangle mesh free from self-intersections to be tested |
np | optional sequence of Named Parameters among the ones listed below |
- Named Parameters
vertex_point_map | the 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 |
geom_traits | a geometric traits class instance |
- Note
- This function is only doing an orientation test for one connected component of
tm
. For performance reasons, it is left to the user to call the function does_bound_a_volume()
on a triangulated version of tm
to ensure the result returned is relevant. For advanced usages, the function volume_connected_components()
should be used instead.
- See also
CGAL::Polygon_mesh_processing::reverse_face_orientations()
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
-
- Parameters
-
points | points of the soup of polygons. Some additional points might be pushed back to resolve non-manifoldness or non-orientability issues. |
polygons | each 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.
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
-
template<class TriangleMesh , class VolumeFaceIndexMap , class NamedParameters >
std::size_t CGAL::Polygon_mesh_processing::volume_connected_components |
( |
const TriangleMesh & |
tm, |
|
|
VolumeFaceIndexMap |
volume_id_map, |
|
|
const NamedParameters & |
np |
|
) |
| |
#include <CGAL/Polygon_mesh_processing/orientation.h>
assigns to each face of tm
an id corresponding to the volume connected component it contributes to.
Using the adjacency relation of two faces along an edge, a triangle mesh can be split into connected components (surface components in the following). A surface component without boundary separates the 3D space into an infinite and a finite volume. We say that the finite volume is enclosed by this surface component.
The volume connected components (volume components in the following) are defined as follows: Each surface component S
that is outside any volume enclosed by another surface component defines the outer boundary of a volume component. Each surface component that is inside the volume enclosed by S
defines a hole if it is included in no other volume enclosed by a surface component but S
. Ignoring the identified volume component, the same procedure is recursively repeated for all surface components in each hole.
There are some special cases:
- a non-closed surface component is reported as a volume component ignoring any inclusion test
- a self-intersecting surface component is reported as a volume component ignoring any inclusion test
- a surface component intersecting another surface component is reported as a volume component, and so are all the surface components inside its enclosed volume
- if
do_orientation_tests
is set to true
, if the holes are not all equally oriented (all inward or all outward) or if the holes and the outer boundary are equally oriented, each surface component is reported as a volume component, and so are all the surface components inside the corresponding enclosed volumes
- If
do_orientation_tests
is set to true
and the surface components that are outside all enclosed volumes are inward oriented, they are then considered as holes of the unbounded volume (that has no outer boundary)
A property map for CGAL::vertex_point_t
must be either available as an internal property map of tm
or provided as one of the Named Parameters.
- Template Parameters
-
TriangleMesh | a model of FaceListGraph |
VolumeFaceIndexMap | a model of WritablePropertyMap with boost::graph_traits<PolygonMesh>::face_descriptor as key type and boost::graph_traits<PolygonMesh>::faces_size_type as value type. |
NamedParameters | a sequence of Named Parameters |
- Parameters
-
tm | the input triangle mesh |
volume_id_map | the property map filled by this function with indices of volume components associated to the faces of tm |
np | optional sequence of Named Parameters among the ones listed below |
- Precondition
CGAL::is_closed(tm)
- Named Parameters
vertex_point_map | the 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_map | a property map containing a unique id per face of tm , in the range [0, num_faces(tm)[ |
face_connected_component_map | a property map filled by this function and that will contain for each face the id of its surface component in the range [0, number of surface components - 1[ |
volume_inclusions | a reference_wrapper (either from boost or the standard library) containing a reference to an object that must be a model of the BackInsertionSequence concept, with a value type being a model of BackInsertionSequence of std::size_t , both types having the functions reserve() and push_back() . The size of the container is exactly the number of surface components of tm . The container at position k contains the ids of all the surface components that are the first intersected by any ray with source on the surface component k and directed outside the volume enclosed by the surface component k . There is only one such id but when some surface components intersect. |
do_orientation_tests | if true (the default value), the orientation of the faces of each surface components will be taken into account for the definition of the volume. If false , the face orientation is ignored and the volumes are defined only by the nesting of surface components. |
error_codes | a reference_wrapper (either from boost or the standard library) containing a reference to a container that must be a model of the BackInsertionSequence concept, with a value_type being Volume_error_code The size of the container is exactly the number of volume components. The container indicates the status of a volume assigned to a set of faces. The description of the value type is given in the documentation of the enumeration type. |
do_self_intersection_tests | If false (the default value), it is assumed that tm does not contains any self-intersections. if true , the input might contain some self-intersections and a test is done prior to the volume decomposition. |
connected_component_id_to_volume_id | a reference_wrapper (either from boost or the standard library) containing a reference to a container that must be a model of the BackInsertionSequence concept, with a value_type being std::size_t . The size of the container is exactly the number of connected components. For each connected component identified using its id ccid , the id of the volume it contributes to describe is the value at the position ccid in the container. |
nesting_levels | a reference_wrapper (either from boost or the standard library) containing a reference to a container that must be a model of the BackInsertionSequence concept, with a value_type being std::size_t . The size of the container is exactly the number of connected components. For each connected component identified using its id ccid , the container contains the number of connected components containing on its bounded side this component. |
is_cc_outward_oriented | a reference_wrapper (either from boost or the standard library) containing a reference to a container that must be a model of the BackInsertionSequence concept, with a value_type being bool . The size of the container is exactly the number of connected components. For each connected component identified using its id ccid , the output of is_outward_oriented() called on the triangle mesh corresponding to this connected component is the value at the position ccid in the container. |
intersecting_volume_pairs_output_iterator | Output iterator into which pairs of ids (id must be convertible to std::size_t ) can be put. Each pair of connected components intersecting will be reported using their ids. If do_self_intersection_tests named parameter is set to false , nothing will be reported.
|
- Returns
- the number of volume components defined by
tm
- Examples:
- Polygon_mesh_processing/volume_connected_components.cpp.