Ver código fonte

verbose debug

Former-commit-id: 2c6dd8cb22cb4b37d56800a8f694ad49f5454d74
Alec Jacobson 10 anos atrás
pai
commit
15330af3fb
1 arquivos alterados com 12 adições e 1 exclusões
  1. 12 1
      include/igl/outer_hull.cpp

+ 12 - 1
include/igl/outer_hull.cpp

@@ -32,7 +32,6 @@ IGL_INLINE void igl::outer_hull(
 {
   using namespace Eigen;
   using namespace std;
-  using namespace igl;
   typedef typename DerivedF::Index Index;
   Matrix<Index,DerivedF::RowsAtCompileTime,1> C;
   typedef Matrix<typename DerivedV::Scalar,Dynamic,DerivedV::ColsAtCompileTime> MatrixXV;
@@ -106,6 +105,18 @@ IGL_INLINE void igl::outer_hull(
       // Angle between n and f
       const RowVector3N & n = N.row(f);
       di_I(fei,0) = M_PI - atan2( eVp.cross(n).dot(eV), eVp.dot(n));
+#ifdef IGL_OUTER_HULL_DEBUG
+      if(di_I(fei,0) != di_I(fei,0) )
+      {
+        cout<<"NaN from face: "<<(f+1)<<endl;
+        cout<<"  n: "<<n<<endl;
+        cout<<"  eVp: "<<eVp<<endl;
+        cout<<"  eV: "<<eV<<endl;
+        cout<<"  eVp x n . eV: "<<(eVp.cross(n).dot(eV))<<endl;
+        cout<<"  eVp . n: "<<(eVp.dot(n))<<endl;
+      }
+#endif
+      assert(di_I(fei,0) == di_I(fei,0) && "NaN Alert!");
       if(!cons[fei])
       {
         di_I(fei,0) = di_I(fei,0) + M_PI;