瀏覽代碼

Merge branch 'master' of https://github.com/libigl/libigl into direct-delta-mush

Dxyk 5 年之前
父節點
當前提交
b0a8fa84e1

+ 1 - 1
include/igl/heat_geodesics.cpp

@@ -152,7 +152,7 @@ IGL_INLINE void igl::heat_geodesics_solve(
   }
   }
   const DerivedD div_X = -data.Div*grad_u;
   const DerivedD div_X = -data.Div*grad_u;
   const DerivedD Beq = (DerivedD(1,1)<<0).finished();
   const DerivedD Beq = (DerivedD(1,1)<<0).finished();
-  igl::min_quad_with_fixed_solve(data.Poisson,(-2.0*div_X).eval(),DerivedD(),Beq,D);
+  igl::min_quad_with_fixed_solve(data.Poisson,(-div_X).eval(),DerivedD(),Beq,D);
   DerivedD Dgamma;
   DerivedD Dgamma;
   igl::slice(D,gamma,Dgamma);
   igl::slice(D,gamma,Dgamma);
   D.array() -= Dgamma.mean();
   D.array() -= Dgamma.mean();

+ 4 - 2
include/igl/opengl/glfw/Viewer.cpp

@@ -432,8 +432,10 @@ namespace glfw
       }
       }
 
 
       data().set_mesh(V,F);
       data().set_mesh(V,F);
-      data().set_uv(UV_V,UV_F);
-
+      if(!UV_V.rows() != 0 && UV_F.rows() != 0)
+      {
+        data().set_uv(UV_V,UV_F);
+      }
     }
     }
     else
     else
     {
     {

+ 2 - 2
include/igl/remove_duplicate_vertices.h

@@ -20,8 +20,8 @@ namespace igl
   //     this as a tolerance on L1 distance
   //     this as a tolerance on L1 distance
   // Outputs:
   // Outputs:
   //   SV  #SV by dim new list of vertex positions
   //   SV  #SV by dim new list of vertex positions
-  //   SVI #V by 1 list of indices so SV = V(SVI,:) 
-  //   SVJ #SV by 1 list of indices so V = SV(SVJ,:)
+  //   SVI #SV by 1 list of indices so SV = V(SVI,:) 
+  //   SVJ #V by 1 list of indices so V = SV(SVJ,:)
   //
   //
   // Example:
   // Example:
   //   % Mesh in (V,F)
   //   % Mesh in (V,F)

+ 27 - 0
tests/include/igl/heat_geodesics.cpp

@@ -0,0 +1,27 @@
+#include <test_common.h>
+#include <igl/heat_geodesics.h>
+#include <igl/upsample.h>
+#include <igl/avg_edge_length.h>
+
+TEST_CASE("heat_geodesic: upsampled cube", "[igl]")
+{
+  Eigen::MatrixXd V;
+  Eigen::MatrixXi F;
+
+  igl::read_triangle_mesh(test_common::data_path("cube.obj"), V, F);
+  igl::upsample(V,F,3);
+
+  int vid = 0;
+  igl::HeatGeodesicsData<double> data;
+  igl::heat_geodesics_precompute(V,F,data);
+  Eigen::VectorXd dist;
+  igl::heat_geodesics_solve(data, (Eigen::VectorXi(1,1)<<vid).finished(), dist);
+  
+  double avg_edge = igl::avg_edge_length(V,F);
+
+  // Check the adjacent corners
+  for (int i=0; i<6; i++) {
+  REQUIRE((V.row(i)-V.row(0)).norm() == Approx(dist(i)).margin(avg_edge));
+  }
+
+}