Easy3D 2.5.3
|
A collection of mesh (and polygon soup) processing functions. More...
#include <easy3d/algo_ext/surfacer.h>
Public Types | |
typedef std::vector< int > | Polygon |
A polygon represented by a list of vertex indices. | |
typedef std::vector< vec3 > | Polyline |
Static Public Member Functions | |
Orientation and stitching | |
static int | stitch_borders (SurfaceMesh *mesh) |
Stitches together border halfedges in a polygon mesh. More... | |
static void | merge_reversible_connected_components (SurfaceMesh *mesh) |
Reverses the connected components having incompatible boundary cycles that could be merged if their orientation were made compatible, and stitches them. Connected components are examined by increasing number of faces. More... | |
static bool | orient_and_stitch_polygon_soup (SurfaceMesh *mesh) |
Tries to consistently orient and stitch a mesh (treated as a polygon soup). More... | |
static void | orient_closed_triangle_mesh (SurfaceMesh *mesh) |
Makes each connected component of a closed triangle surface mesh inward or outward oriented. More... | |
static bool | orient_and_stitch_polygon_soup (std::vector< vec3 > &points, std::vector< Polygon > &polygons) |
Tries to consistently orient and stitch a polygon soup. More... | |
static void | repair_polygon_soup (std::vector< vec3 > &points, std::vector< Polygon > &polygons) |
Repairs a given polygon soup through various repairing operations. More... | |
static void | repair_polygon_soup (SurfaceMesh *mesh) |
Repairs a given polygon mesh through various repairing operations. More... | |
Degenerate, overlapping, and duplicate faces removal | |
static unsigned int | remove_degenerate_faces (SurfaceMesh *mesh, float length_threshold=1e-5) |
Remove degenerate faces. More... | |
static void | detect_overlapping_faces (SurfaceMesh *mesh, std::vector< std::pair< SurfaceMesh::Face, SurfaceMesh::Face > > &duplicate_faces, std::vector< std::pair< SurfaceMesh::Face, SurfaceMesh::Face > > &folding_faces, double dist_threshold=1e-6) |
Detects duplicate faces and folding faces. More... | |
static unsigned int | remove_overlapping_faces (SurfaceMesh *mesh, bool folding_faces=false, double dist_threshold=1e-6) |
Removes duplicate faces and and folding faces. More... | |
Self intersections | |
static std::vector< std::pair< SurfaceMesh::Face, SurfaceMesh::Face > > | detect_self_intersections (SurfaceMesh *mesh) |
Collects all pairs of intersecting faces of a triangulated surface mesh. More... | |
static bool | remesh_self_intersections (SurfaceMesh *mesh, bool stitch=true) |
Detects and remesh the intersecting faces. More... | |
Clip, split, and slice | |
static bool | clip (SurfaceMesh *mesh, const Plane3 &plane, bool clip_volume=false) |
Clips a triangle mesh by keeping the part on the negative side of a plane (side opposite to its normal vector). More... | |
static void | split (SurfaceMesh *mesh, const Plane3 &plane) |
Split a triangle mesh by a plane. More... | |
static std::vector< Polyline > | slice (SurfaceMesh *mesh, const Plane3 &plane) |
Computes the intersection of a plane with a triangle surface mesh. More... | |
static std::vector< std::vector< Polyline > > | slice (SurfaceMesh *mesh, const std::vector< Plane3 > &planes) |
Computes the intersection of a set of planes with a triangle surface mesh. More... | |
A collection of mesh (and polygon soup) processing functions.
This class collects some related algorithms implemented using CGAL. It allows (re)orientation, detecting and resolving topological issues (e.g., duplicate vertices/faces, self intersection), and clipping/splitting/slicing of a surface mesh.
A polyline represented by a list of points. If a polyline is closed, its first and last points will be identical.
|
static |
Clips a triangle mesh by keeping the part on the negative side of a plane (side opposite to its normal vector).
If mesh
is closed, the clipped part can be closed too if the named parameter clip_volume
is set to true
.
mesh | The input triangle mesh. |
plane | The clipping plane whose negative side defines the half-space to intersect mesh with. |
true
if the output surface mesh is manifold. If false
is returned
|
static |
Detects duplicate faces and folding faces.
Two triangle faces are said duplicate if they have the same geometry (vertices within a distance threshold). Two triangle faces are said folding if they are coplanar, share one edge (i.e., have the same edge geometry), and partially overlap.
duplicate_faces | Returns the duplicate face pairs found. |
folding_faces | Returns the folding face pairs found. |
dist_threshold | Two vertices are considered coincident if there distance is smaller than it. |
|
static |
Collects all pairs of intersecting faces of a triangulated surface mesh.
Two faces are said to intersect if the corresponding triangles intersect and the intersection is not an edge nor a vertex incident to both faces.
mesh | The triangle surface mesh to be checked. |
|
static |
Reverses the connected components having incompatible boundary cycles that could be merged if their orientation were made compatible, and stitches them. Connected components are examined by increasing number of faces.
|
static |
Tries to consistently orient and stitch a polygon soup.
When it is not possible to produce a combinatorial manifold surface, some points are duplicated.
The algorithm is described in
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 describes a polygon represented by the index of its vertices in points . If needed the order of the indices of a polygon might be reversed. |
true
if the orientation operation succeeded. false
if some points were duplicated, thus producing a self-intersecting polyhedron.
|
static |
Tries to consistently orient and stitch a mesh (treated as a polygon soup).
Internally, it calls orient_and_stitch_polygon_soup(std::vector<vec3>& points, std::vector<Polygon>& polygons).
|
static |
Makes each connected component of a closed triangle surface mesh inward or outward oriented.
mesh | The input mesh. |
|
static |
Detects and remesh the intersecting faces.
mesh | The input mesh. If self intersection exists, it carries the remeshed model. Otherwise it remains unchanged. |
stitch | Stitch the borders |
true
if remesh actually occurred (i.e., self intersection was detected).
|
static |
Remove degenerate faces.
Any triangle with an edge length smaller than a given threshold is consider degenerate and will be removed by the edge collapse operation.
length_threshold | The edge length threshold. |
|
static |
Removes duplicate faces and and folding faces.
Two triangle faces are said duplicate if they have the same geometry (vertices within a distance threshold). Two triangle faces are said folding if they are coplanar, share one edge (i.e., have the same edge geometry), and partially overlap.
folding_faces | true also to remove folding faces. |
Repairs a given polygon soup through various repairing operations.
This function carries out the following tasks, in the same order as they are listed:
|
static |
Repairs a given polygon mesh through various repairing operations.
This function carries out the following tasks, in the same order as they are listed:
|
static |
Computes the intersection of a plane with a triangle surface mesh.
mesh | The input triangle mesh. |
plane | The plane to intersect the triangle surface mesh with. |
P
is oriented such that for two consecutive points p
and q
in P
, the normal vector of the face(s) containing the segment pq, the vector pq
, and the normal of plane
is a direct orthogonal basis. The normal vector of each face is chosen to point on the side of the face where its sequence of vertices is seen counterclockwise.
|
static |
Computes the intersection of a set of planes with a triangle surface mesh.
mesh | The input triangle mesh. |
planes | The set of planes to intersect the triangle surface mesh with. |
i_th
entry denotes the polylines created by the i_th
plane. Each resulting polyline P
is oriented such that for two consecutive points p
and q
in P
, the normal vector of the face(s) containing the segment pq, the vector pq
, and the normal of plane
is a direct orthogonal basis. The normal vector of each face is chosen to point on the side of the face where its sequence of vertices is seen counterclockwise.
|
static |
Split a triangle mesh by a plane.
It adds intersection edges of mesh
and plane
in mesh
and duplicates those edges.
mesh | The input triangle mesh. |
plane | The plane that will be used to split mesh . |
|
static |
Stitches together border halfedges in a polygon mesh.
The pairs of halfedges to be stitched are automatically found amongst all border halfedges. Two border halfedges h1 and h2 can be stitched if the points associated to the source and target vertices of h1 are the same as those of the target and source vertices of h2 respectively.