Parcourir la source

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

Former-commit-id: 62457d1883d07b559c1829cb2224babeb8d47dc0
Alec Jacobson il y a 9 ans
Parent
commit
fab9350228
2 fichiers modifiés avec 6 ajouts et 5 suppressions
  1. 1 0
      .gitignore
  2. 5 5
      include/igl/viewer/ViewerCore.cpp

+ 1 - 0
.gitignore

@@ -92,3 +92,4 @@ tests/build
 tests/bin
 python/build3
 *.pyc
+python/build4

+ 5 - 5
include/igl/viewer/ViewerCore.cpp

@@ -111,12 +111,12 @@ IGL_INLINE void igl::viewer::ViewerCore::get_scale_and_shift_to_fit_mesh(
   if (V.rows() == 0)
     return;
 
-  //Eigen::SparseMatrix<double> M;
-  //igl::massmatrix(V,F,igl::MASSMATRIX_TYPE_VORONOI,M);
-  //const auto & MV = M*V;
-  //Eigen::RowVector3d centroid  = MV.colwise().sum()/M.diagonal().sum();
   Eigen::MatrixXd BC;
-  igl::barycenter(V,F,BC);
+  if (F.rows() <= 1)
+    BC = V;
+  else
+    igl::barycenter(V,F,BC);
+
   Eigen::RowVector3d min_point = BC.colwise().minCoeff();
   Eigen::RowVector3d max_point = BC.colwise().maxCoeff();
   Eigen::RowVector3d centroid  = 0.5*(min_point + max_point);