58 std::vector<std::pair<SurfaceMesh::Face, SurfaceMesh::Face> >
72 typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
75 typedef CGAL::Point_3<Kernel> Point_3;
76 typedef CGAL::Vector_3<Kernel> Vector_3;
77 typedef CGAL::Triangle_3<Kernel> Triangle_3;
78 typedef CGAL::Segment_3<Kernel> Segment_3;
79 typedef CGAL::Plane_3<Kernel> Plane_3;
82 typedef CGAL::Triangulation_vertex_base_2<Kernel> TVB_2;
83 typedef CGAL::Constrained_triangulation_face_base_2<Kernel> CTFB_2;
84 typedef CGAL::Triangulation_data_structure_2<TVB_2, CTFB_2> TDS_2;
85 typedef CGAL::Exact_intersections_tag Itag;
86 typedef CGAL::Constrained_Delaunay_triangulation_2<Kernel, TDS_2, Itag> CDT_2;
87 typedef CGAL::Constrained_triangulation_plus_2<CDT_2> CDT_plus_2;
89 typedef std::vector<std::pair<int, CGAL::Object> > ObjectList;
92 Triangle(
const Point_3 &a,
const Point_3 &b,
const Point_3 &c,
SurfaceMesh::Face f)
93 : triangle(a, b, c), face(f), index(-1) {}
98 std::vector<SurfaceMesh::Vertex> vertices;
102 typedef std::vector<Triangle> Triangles;
103 typedef Triangles::iterator TrianglesIterator;
104 typedef CGAL::Box_intersection_d::Box_with_handle_d<double, 3, TrianglesIterator> Box;
111 void mesh_to_cgal_triangle_list(
SurfaceMesh *mesh);
119 bool do_intersect(
const Triangle &A,
const Triangle &B);
136 const std::vector<CGAL::Object> &objects,
138 std::vector<Point_3> &vertices,
139 std::vector<std::vector<int> > &faces
156 void insert_into_cdt(
const CGAL::Object &obj,
const Plane_3 &P, CDT_plus_2 &cdt);
162 inline void mark_offensive(
int f);
165 inline void count_intersection(
int fa,
int fb);
174 inline bool intersect(
const Triangle &A,
const Triangle &B);
186 inline bool single_shared_vertex(
const Triangle &A,
const Triangle &B,
int va,
int vb);
189 inline bool single_shared_vertex(
const Triangle &A,
const Triangle &B,
int va);
195 inline bool double_shared_vertex(
198 const std::vector<std::pair<int, int> > &shared
204 bool construct_intersection_;
206 Triangles triangle_faces_;
209 std::unordered_map<int, SurfaceMesh::Face> original_face;
213 std::unordered_map<int, ObjectList> offending_;
216 int total_comb_duplicate_face_;
217 int total_geom_duplicate_face_;
std::vector< std::pair< SurfaceMesh::Face, SurfaceMesh::Face > > detect(SurfaceMesh *mesh, bool construct=false)
Detect intersecting face pairs.
Definition self_intersection.cpp:40
bool remesh(SurfaceMesh *mesh, bool stitch)
Detect and remesh the intersecting faces.
Definition self_intersection.cpp:427