Browse Source

Merge branch 'master' of github.com:libigl/libigl

Former-commit-id: 5962931c34d198351158da8e97911db501ad5b9c
Alec Jacobson 11 years ago
parent
commit
1884fc3258

+ 2 - 1
build/Makefile.conf

@@ -106,7 +106,8 @@ endif
 ifeq ($(IGL_USERNAME),daniele)
 	IGL_WITH_MATLAB=0
 	AFLAGS=-m64
-	GG=g++-mp-4.7
+	GG=g++-4.7
+	EIGEN3_INC=-I/usr/local/include/eigen3
 endif
 
 ifeq ($(IGL_USERNAME),olkido)

+ 3 - 1
include/igl/deform_skeleton.cpp

@@ -39,8 +39,10 @@ IGL_INLINE void igl::deform_skeleton(
   {
     BET(e,0) = 2*e;
     BET(e,1) = 2*e+1;
+    Matrix4d t;
+    t << T.block(e*4,0,4,3).transpose(), 0,0,0,0;
     Affine3d a;
-    a.matrix() = T.block(e*4,0,4,3).transpose();
+    a.matrix() = t;
     Vector3d c0 = C.row(BE(e,0));
     Vector3d c1 = C.row(BE(e,1));
     CT.row(2*e) =   a * c0;

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

+ 15 - 8
include/igl/viewer/Viewer.cpp

@@ -410,6 +410,11 @@ namespace igl
                " indices'");
 
     core.init();
+
+    if (callback_init)
+      if (callback_init(*this))
+        return;
+
     init_plugins();
   }
 
@@ -425,6 +430,7 @@ namespace igl
     data.set_face_based(false);
 
     // C-style callbacks
+    callback_init         = 0;
     callback_pre_draw     = 0;
     callback_post_draw    = 0;
     callback_mouse_down   = 0;
@@ -434,14 +440,15 @@ namespace igl
     callback_key_down     = 0;
     callback_key_up       = 0;
 
-    callback_pre_draw_data = 0;
-    callback_post_draw     = 0;
-    callback_mouse_down    = 0;
-    callback_mouse_up      = 0;
-    callback_mouse_move    = 0;
-    callback_mouse_scroll  = 0;
-    callback_key_down      = 0;
-    callback_key_up        = 0;
+    callback_init_data          = 0;
+    callback_pre_draw_data      = 0;
+    callback_post_draw_data     = 0;
+    callback_mouse_down_data    = 0;
+    callback_mouse_up_data      = 0;
+    callback_mouse_move_data    = 0;
+    callback_mouse_scroll_data  = 0;
+    callback_key_down_data      = 0;
+    callback_key_up_data        = 0;
 
   }
 

+ 2 - 0
include/igl/viewer/Viewer.h

@@ -108,6 +108,7 @@ namespace igl
 
 
     // C-style callbacks
+    bool (*callback_init)(Viewer& viewer);
     bool (*callback_pre_draw)(Viewer& viewer);
     bool (*callback_post_draw)(Viewer& viewer);
     bool (*callback_mouse_down)(Viewer& viewer, int button, int modifier);
@@ -118,6 +119,7 @@ namespace igl
     bool (*callback_key_up)(Viewer& viewer, unsigned char key, int modifiers);
 
     // Pointers to per-callback data
+    void* callback_init_data;
     void* callback_pre_draw_data;
     void* callback_post_draw_data;
     void* callback_mouse_down_data;