removes almost degenerate faces in a range of faces from a triangulated surface mesh.
Almost degenerated triangle faces are classified as caps or needles: a triangle is said to be a needle if its longest edge is much longer than its shortest edge. A triangle is said to be a cap if one of its angles is close to 180 degrees. Needles are removed by collapsing their shortest edges, while caps are removed by flipping the edge opposite to the largest angle (with the exception of caps on the boundary that are simply removed from the mesh).
the initial range of faces to be considered to look for badly shaped triangles. Note that modifications of tmesh are not limited to faces in face_range and neighbor faces might also be impacted.
tmesh
the triangulated surface mesh to be modified
np
an optional sequence of Named Parameters among the ones listed below
Optional Named Parameters
the cosine of a minimum angle such that if a face has an angle greater than this bound, it is a cap. The threshold is in range [-1 0] and corresponds to an angle between 90 and 180 degrees.
Type: double
Default: the cosinus corresponding to an angle of 160 degrees
a bound on the ratio of the lengths of the longest edge and the shortest edge, such that a face having a ratio larger than the threshold is a needle.
Type: double
Default: 4
if different from 0, an edge collapsed will be prevented if the edge is longer than the threshold given.
Type: double
Default: 0
if different from 0, an edge flip will be prevented if the height of the triangle (whose base is the edge to be flipped) is longer than the threshold given.
Type: double
Default: 0
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
Extra: The geometric traits class must be compatible with the vertex point type.
a property map containing the constrained-or-not status of each edge of tmesh.
Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh>::edge_descriptor as key type and bool as value type.
Default: a default property map where no edge is constrained.
Extra: A constrained edge can not be collapsed nor flipped.
a property map containing the constrained-or-not status of each vertex of tmesh.
Type: a class model of ReadablePropertyMap with boost::graph_traits<PolygonMesh>::vertex_descriptor as key type and bool as value type.
Default: a default property map where no vertex is constrained.
Extra: A constrained vertex is guaranteed to be present in tmesh after the function call.
A function object providing bool operator()(geom_traits::Point_3,geom_traits::Point_3,geom_traits::Point_3).
Type: The function object is queried each time a new triangle is about to be created by a flip or a collapse operation. If false is returned, the operation is cancelled.
Default: a functor always returning true.
Returns
true if no almost degenerate face could not be removed (due to topological constraints), and false otherwise.
Extra: The geometric traits class must be compatible with the vertex point type.
Extra: Exact constructions kernels are not supported by this function.
a property map associating to each face of tmesh a unique index between 0 and num_faces(tmesh) - 1
Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::face_descriptor as key type and std::size_t as value type
Default: an automatically indexed internal map
a fixed value such that only connected components whose area is larger than this value are kept
Type: geom_traits::FT
Default: 1% of the length of the diagonal of the axis-aligned bounding box of the mesh, squared
a fixed value such that only connected components whose volume is larger than this value are kept (only applies to closed connected components)
Type: geom_traits::FT
Default: 1% of the length of the diagonal of the axis-aligned bounding box of the mesh, cubed
Extra: The mesh must be closed.
a property map containing the constrained-or-not status of each edge of tmesh
Type: a class model of ReadablePropertyMap with boost::graph_traits<TriangleMesh>::edge_descriptor as key type and bool as value type. It must be default constructible.
Default: a default property map where no edge is constrained
Extra: A constrained edge can be split or collapsed, but not flipped, nor its endpoints moved by smoothing.
If true, the mesh will not be altered, but the number of components that would be removed is returned.
Type: Boolean
Default: false
An output iterator to collect the faces that would be removed by the algorithm, when using the "dry run" mode (see parameter dry_run)
Type: a model of OutputIterator with value type face_descriptor
Default: unused
Returns
the number of connected components removed (ignoring isolated vertices).