Overview
This tutorial provides usage examples of various triangle mesh defect detection methods, designed to identify multiple types of defects in triangle meshes.
Function Description
Used to detect various defects in triangle meshes, including:
- Non-manifold vertices (a vertex connected to two or more discontinuous faces): Returns vertex indices
std::vector<size_t>
- Non-manifold edges (an edge shared by more than two triangular faces): Returns the two vertex indices of the edge
std::vector<std::pair<size_t, size_t>>
- Non-manifold edges ForPrint3D: Returns the two vertex indices of the edge
std::vector<std::pair<size_t, size_t>>, including free edges
- Free edges (edges belonging to only one triangular face, i.e., boundary edges): Returns the two vertex indices of the edge
std::vector<std::pair<size_t, size_t>>
- Duplicate vertices (two or more vertices with identical coordinates): Returns clusters of duplicate vertices
std::vector<std::vector<size_t>>
- Duplicate faces (two or more triangular faces with identical vertex indices, possibly in different orders): Returns face indices
std::vector<size_t>
- Degenerate faces (triangular faces with zero or near-zero area, e.g., collinear vertices): Returns face indices
std::vector<size_t>
- Isolated faces (isolated triangular faces not connected to other faces via shared edges): Returns face indices
std::vector<size_t>
- Self-intersecting faces (two triangular faces intersecting at non-shared edges): Returns face indices
std::vector<size_t>
- Inconsistent orientation (adjacent triangular faces with inconsistent normals, causing incorrect inner/outer surface orientation): Returns two sets of face indices with inconsistent orientation for each connected component
std::vector<std::pair<std::vector<size_t>, std::vector<size_t>>>
Usage Example
using TriSoupTraits = AMCAX::Meshing::Mesh::TriSoupTraits_Coord;
using VecT = TriSoupTraits::VecT;
using PointT = TriSoupTraits::PointT;
using Points = TriSoupTraits::Points;
using Triangles = TriSoupTraits::Triangles;
int main()
{
OBJReader obj_reader;
OBJWriter obj_writer;
IOOptions io_options;
io_options.vertex_has_point = true;
Points input_points;
Triangles input_triangles;
obj_reader.read("./data/panda.obj", io_options);
input_points = std::move(obj_reader.m_points);
input_triangles = std::move(obj_reader.m_triangles);
auto non_manifold_vertices = detector.DetectNonManifoldVertices();
auto non_manifold_edges = detector.DetectNonManifoldEdges();
auto non_manifold_edges_for_3DPrint = detector.DetectNonManifoldEdgesFor3DPrint();
auto free_edges = detector.DetectFreeEdges();
auto degenerate_faces = detector.DetectDegenerateFaces();
auto duplicate_faces = detector.DetectDuplicateFaces();
auto isolated_faces = detector.DetectIsolatedFaces();
auto duplicate_vertices = detector.DetectDuplicateVertices();
auto self_intersecting_faces = detector.DetectSelfIntersectingFaces();
auto component_with_inconsistent_nosistent_normals = detector.DetectFacesWithInconsistentNormals();
}
TriMesh NonManifold detector algorithm.
Define traits for triangle soup.
Options about pre-described properties in mesh IO.
Definition IOOptions.hpp:19
Read triangle soup from an OBJ file.
Definition OBJReader.hpp:38
Write triangle soup to an OBJ file.
Definition OBJWriter.hpp:38
Click here to download the complete source code for the above examples. Please download it as needed for your learning purposes.