浏览代码

Minor update to delaunay triangulation.

Former-commit-id: e76f9fb5d264c701a6b1c674a99d890dafed1138
Qingnan Zhou 8 年之前
父节点
当前提交
056d4a4f15
共有 2 个文件被更改,包括 6 次插入3 次删除
  1. 5 0
      include/igl/copyleft/cgal/delaunay_triangulation.cpp
  2. 1 3
      include/igl/flip_edge.cpp

+ 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 \