Browse Source

fixed bug in principal_curvature when radius was set to < 2

Former-commit-id: bbcbf740444c4361a680873388d862aff71c9d55
Daniele Panozzo 10 years ago
parent
commit
e2e1f4f323
1 changed files with 8 additions and 2 deletions
  1. 8 2
      include/igl/principal_curvature.cpp

+ 8 - 2
include/igl/principal_curvature.cpp

@@ -418,8 +418,8 @@ IGL_INLINE void CurvatureCalculator::finalEigenStuff (int i, std::vector<Eigen::
   v2global.normalize();
 
   v1global *= c_val(0);
-  v2global *= c_val(1);  
-  
+  v2global *= c_val(1);
+
   if (c_val[0] > c_val[1])
   {
     curv[i]=std::vector<double>(2);
@@ -794,6 +794,12 @@ IGL_INLINE void igl::principal_curvature(
 {
   using namespace std;
 
+  if (radius < 2)
+  {
+    radius = 2;
+    cout << "WARNING: igl::principal_curvature needs a radius >= 2, fixing it to 2." << endl;
+  }
+
   // Preallocate memory
   PD1.resize(V.rows(),3);
   PD2.resize(V.rows(),3);