فهرست منبع

Merge pull request #768 from YijingLi-Gene/patch-remesh_intersections

fix a bug in remesh_intersections

Former-commit-id: 74c269a94957c4a133c85c4a1a54d0fed457d2b6
Alec Jacobson 7 سال پیش
والد
کامیت
ffc2788f0a
1فایلهای تغییر یافته به همراه9 افزوده شده و 0 حذف شده
  1. 9 0
      include/igl/copyleft/cgal/remesh_intersections.cpp

+ 9 - 0
include/igl/copyleft/cgal/remesh_intersections.cpp

@@ -148,6 +148,8 @@ IGL_INLINE void igl::copyleft::cgal::remesh_intersections(
     std::vector<Index> source_faces;
     std::vector<Point_3> new_vertices;
     EdgeMap edge_vertices;
+    // face_vertices: Given a face Index, find vertices inside the face
+    std::unordered_map<Index, std::vector<Index>> face_vertices;
 
     // Run constraint Delaunay triangulation on the plane.
     // 
@@ -252,8 +254,15 @@ IGL_INLINE void igl::copyleft::cgal::remesh_intersections(
         }
 
         // p must be in the middle of the triangle.
+        auto & existing_face_vertices = face_vertices[ori_f];
+        for(const auto vid : existing_face_vertices) {
+          if (p == new_vertices[vid - num_base_vertices]) {
+            return vid;
+          }
+        }
         const size_t index = num_base_vertices + new_vertices.size();
         new_vertices.push_back(p);
+        existing_face_vertices.push_back(index);
         return index;
       }
     };