Browse Source

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

Former-commit-id: 2f5f424ca8ee0e44b38ebab66f3ef398b0544918
Olga Diamanti 9 years ago
parent
commit
c4cd20fde3

+ 4 - 1
include/igl/boundary_conditions.cpp

@@ -162,8 +162,11 @@ IGL_INLINE bool igl::boundary_conditions(
 
   // If there's only a single boundary condition, the following tests
   // are overzealous.
-  if(bc.rows() == 1)
+  if(bc.cols() == 1)
   {
+    // If there is only one weight function,
+    // then we expect that there is only one handle.
+    assert(P.rows() + BE.rows() == 1);
     return true;
   }
 

+ 4 - 1
include/igl/gaussian_curvature.h

@@ -11,12 +11,15 @@
 #include <Eigen/Core>
 namespace igl
 {
-  // Compute discrete gaussian curvature (angle deficit)
+  // Compute discrete local integral gaussian curvature (angle deficit, without
+  // averaging by local area).
+  //
   // Inputs:
   //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
   //   F  #F by 3 eigen Matrix of face (triangle) indices
   // Output:
   //   K  #V by 1 eigen Matrix of discrete gaussian curvature values
+  //
   template <typename DerivedV, typename DerivedF, typename DerivedK>
   IGL_INLINE void gaussian_curvature(
     const Eigen::PlainObjectBase<DerivedV>& V,

+ 9 - 0
tutorial/202_GaussianCurvature/main.cpp

@@ -1,4 +1,6 @@
 #include <igl/gaussian_curvature.h>
+#include <igl/massmatrix.h>
+#include <igl/invert_diag.h>
 #include <igl/readOFF.h>
 #include <igl/viewer/Viewer.h>
 #include <igl/jet.h>
@@ -13,7 +15,14 @@ int main(int argc, char *argv[])
   igl::readOFF(TUTORIAL_SHARED_PATH "/bumpy.off",V,F);
 
   VectorXd K;
+  // Compute integral of Gaussian curvature
   igl::gaussian_curvature(V,F,K);
+  // Compute mass matrix
+  SparseMatrix<double> M,Minv;
+  igl::massmatrix(V,F,igl::MASSMATRIX_TYPE_DEFAULT,M);
+  igl::invert_diag(M,Minv);
+  // Divide by area to get integral average
+  K = (Minv*K).eval();
 
   // Compute pseudocolor
   MatrixXd C;