Переглянути джерело

Minor update to delaunay triangulation.

Former-commit-id: e76f9fb5d264c701a6b1c674a99d890dafed1138
Qingnan Zhou 8 роки тому
батько
коміт
056d4a4f15

+ 5 - 0
include/igl/copyleft/cgal/delaunay_triangulation.cpp

@@ -22,11 +22,16 @@ IGL_INLINE void igl::copyleft::cgal::delaunay_triangulation(
     const Eigen::PlainObjectBase<DerivedV>& V,
     Eigen::PlainObjectBase<DerivedF>& F)
 {
+  assert(V.cols() == 2);
   typedef typename DerivedF::Scalar Index;
   typedef typename DerivedV::Scalar Scalar;
   typedef typename igl::copyleft::cgal::ExactPredicate<Scalar> Predicate;
   igl::copyleft::cgal::lexicographic_triangulation(V, F);
   const size_t num_faces = F.rows();
+  if (num_faces == 0) {
+    // Input points are degenerate.  No faces will be generated.
+    return;
+  }
   assert(F.cols() == 3);
 
   Eigen::MatrixXi E;

+ 1 - 3
include/igl/flip_edge.cpp

@@ -22,9 +22,7 @@ IGL_INLINE void igl::flip_edge(
 {
   typedef typename DerivedF::Scalar Index;
   const size_t num_faces = F.rows();
-  if (F.cols() != 3) {
-    throw "Edge flip only works on triangle mesh";
-  }
+  assert(F.cols() == 3);
   //          v1                 v1
   //          /|\                / \
   //         / | \              /f1 \