Browse Source

add test for remesh_along_isoline

Kazutaka Nakashima 6 years ago
parent
commit
2d7037a945
1 changed files with 32 additions and 0 deletions
  1. 32 0
      tests/include/igl/remesh_along_isoline.cpp

+ 32 - 0
tests/include/igl/remesh_along_isoline.cpp

@@ -0,0 +1,32 @@
+#include <test_common.h>
+#include <igl/remesh_along_isoline.h>
+#include <igl/facet_components.h>
+#include <Eigen/Sparse>
+
+TEST_CASE("remesh_along_isoline: triangle_mesh", "[igl]")
+{
+  Eigen::MatrixXd V;
+  Eigen::MatrixXi F;
+  //This is a cube of dimensions 1.0x1.0x1.0
+  test_common::load_mesh("cube.obj", V, F);
+  const double mean_z = V.col(2).mean();
+
+  Eigen::VectorXi C;
+  igl::facet_components(F, C);
+  const int fc_count_before = C.maxCoeff();
+
+  Eigen::VectorXd S = V.col(2);
+  Eigen::MatrixXd U;
+  Eigen::MatrixXi G;
+  Eigen::VectorXd SU;
+  Eigen::VectorXi J;
+  Eigen::SparseMatrix<double> BC;
+  Eigen::VectorXi L;
+  igl::remesh_along_isoline(V,F,S,mean_z,U,G,SU,J,BC,L);
+
+  igl::facet_components(G, C);
+  const int fc_count_after = C.maxCoeff();
+
+  // number of face connected components should not change
+  REQUIRE(fc_count_before == fc_count_after);
+}