소스 검색

fix from Nikolas to principal_curvature.cpp

Former-commit-id: 3b6be08d2e540c98659e8d0196af09e6e81962a3
Daniele Panozzo 11 년 전
부모
커밋
b038641fd3
1개의 변경된 파일17개의 추가작업 그리고 14개의 파일을 삭제
  1. 17 14
      include/igl/principal_curvature.cpp

+ 17 - 14
include/igl/principal_curvature.cpp

@@ -307,11 +307,11 @@ public:
 
 IGL_INLINE CurvatureCalculator::CurvatureCalculator()
 {
-  this->localMode=false;
-  this->projectionPlaneCheck=false;
+  this->localMode=true;
+  this->projectionPlaneCheck=true;
   this->sphereRadius=5;
   this->st=SPHERE_SEARCH;
-  this->nt=PROJ_PLANE;
+  this->nt=AVERAGE;
   this->montecarlo=false;
   this->montecarloN=0;
   this->kRing=3;
@@ -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);
@@ -697,6 +697,18 @@ IGL_INLINE void CurvatureCalculator::computeCurvature()
       std::cerr << "Could not compute curvature of radius " << scaledRadius << endl;
       return;
     }
+
+
+    if (projectionPlaneCheck)
+    {
+      vvtmp.reserve (vv.size ());
+      applyProjOnPlane (vertex_normals.row(i), vv, vvtmp);
+      if (vvtmp.size() >= 6 && vvtmp.size()<vv.size())
+	  vv = vvtmp;
+
+    }
+
+
     switch (nt)
     {
       case AVERAGE:
@@ -709,15 +721,6 @@ IGL_INLINE void CurvatureCalculator::computeCurvature()
         fprintf(stderr,"Error: normal type not recognized");
         return;
     }
-
-    if (projectionPlaneCheck)
-    {
-      vvtmp.reserve (vv.size ());
-      applyProjOnPlane (normal, vv, vvtmp);
-      if (vvtmp.size() >= 6)
-        vv = vvtmp;
-    }
-
     if (vv.size()<6)
     {
       std::cerr << "Could not compute curvature of radius " << scaledRadius << endl;