Browse Source

sparse_voxel_grid test

Alec Jacobson 5 years ago
parent
commit
4d628e75fe
1 changed files with 22 additions and 0 deletions
  1. 22 0
      tests/include/igl/sparse_voxel_grid.cpp

+ 22 - 0
tests/include/igl/sparse_voxel_grid.cpp

@@ -0,0 +1,22 @@
+#include <test_common.h>
+#include <igl/sparse_voxel_grid.h>
+#include <igl/unique_rows.h>
+
+TEST_CASE("sparse_voxel_grid: unique", "[igl]" )
+{
+  const std::function<double(const Eigen::RowVector3d & x)> f = 
+    [&](const Eigen::RowVector3d & x)->double
+  {
+    return x.norm() - 1.0;
+  };
+  Eigen::RowVector3d p0(0,1.0,0);
+  Eigen::MatrixXd GV;
+  Eigen::VectorXd Gf;
+  Eigen::Matrix<int,Eigen::Dynamic,8> GI;
+  igl::sparse_voxel_grid(p0,f,1,1024,Gf,GV,GI);
+  Eigen::MatrixXd uGV;
+  Eigen::VectorXi _1,_2;
+  igl::unique_rows(GV,uGV,_1,_2);
+  REQUIRE(GV.rows() == uGV.rows());
+}
+