43TEST_CASE(
"Basic voxelization test",
"[voxelization]")
53 using TriOr = MeshVoxelizer6::TriangleOrientation;
56 SECTION(
"Test distance point/plan 3D")
59 const PointR3 A(38.6908 , 14.5441 , -0.71205);
60 const PointR3 B(34.6171 , 13.5999 , 2.44455);
61 const PointR3 C(37.4205 , 2.44239 , 6.31301);
64 const PointZ3 v(35, 2, 5);
66 const VectorR3 e1 = A - B;
67 const VectorR3 e2 = A - C;
69 double distance = MeshVoxelizer6::distance(A, e1.crossProduct(e2), v);
76 SECTION(
"Test if 2D point is inside triangle 2D")
84 OrientationFunctor orientationFunctor;
89 if(! pointPredicate(A, B, C))
103 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_OUTSIDE);
107 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_INSIDE);
111 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_ONEDGE);
115 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_ONVERTEX);
120 C = { -16.3299, 0. };
122 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_OUTSIDE);
125 A = { -0.891282, 9.91201 };
126 B = { -1.40823, 9.91261 };
127 C = { -1.36963, 9.37414 };
128 v = { -1.16961, 9.83039 };
129 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(A, B, C, v) == TriOr::TRIANGLE_INSIDE);
133 SECTION(
"Test if 3D point is inside voxel")
136 PointR3 P(-0.89, 9.91, 0.86);
137 PointZ3 v(-1, 10, 1);
139 REQUIRE(MeshVoxelizer6::pointIsInsideVoxel(P, v) ==
true);
143 REQUIRE(MeshVoxelizer6::pointIsInsideVoxel(P, v) ==
true);
147 REQUIRE(MeshVoxelizer6::pointIsInsideVoxel(P, v) ==
false);
152 REQUIRE(MeshVoxelizer6::pointIsInsideVoxel(P, v) ==
false);
156 SECTION(
"26-sep voxelization of a single triangle")
160 MeshVoxelizer26 voxelizer;
162 voxelizer.voxelize(outputSet,
Point(5,0,0),
Point(0,5,0),
Point(0,0,5));
164 for(
auto p: outputSet)
166 board.
saveOBJ(
"triangle26-dig.obj");
172 SECTION(
"6-sep voxelization of a single triangle")
176 MeshVoxelizer6 voxelizer;
178 voxelizer.voxelize(outputSet,
Point(5,0,0),
Point(0,5,0),
Point(0,0,5));
180 for(
auto p: outputSet)
182 board.
saveOBJ(
"triangle6-dig.obj");
188 SECTION(
"6-sep voxelization of a OFF cube mesh")
195 MeshVoxelizer6 voxelizer;
199 voxelizer.voxelize(outputSet, inputMesh, 10.0 );
201 for(
auto p: outputSet)
210 SECTION(
"26-sep voxelization of a OFF cube mesh")
217 MeshVoxelizer26 voxelizer;
221 voxelizer.voxelize(outputSet, inputMesh, 10.0 );
223 for(
auto p: outputSet)
225 board.
saveOBJ(
"box26-dig.obj");