42{
47
50
51 using TriOr = MeshVoxelizer6::TriangleOrientation;
52
53
54 SECTION(
"Test distance point/plan 3D")
55 {
56
57 const PointR3
A(38.6908 , 14.5441 , -0.71205);
58 const PointR3
B(34.6171 , 13.5999 , 2.44455);
59 const PointR3 C(37.4205 , 2.44239 , 6.31301);
60
61
62 const PointZ3 v(35, 2, 5);
63
64 const VectorR3 e1 =
A -
B;
65 const VectorR3 e2 =
A - C;
66
67 double distance = MeshVoxelizer6::distance(
A, e1.crossProduct(e2), v);
68
71 }
72
73
74 SECTION(
"Test if 2D point is inside triangle 2D")
75 {
76
79 PointR2 C(3.0, 1.0);
80
82 OrientationFunctor orientationFunctor;
83
84
86
87 if(! pointPredicate(
A,
B, C))
88 {
90 }
91
92
93
94
95
96
97 PointR2 v;
98
99 v[0] = 3.0;
100 v[1] = 3.0;
101 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(
A,
B, C, v) == TriOr::TRIANGLE_OUTSIDE);
102
103 v[0] = 2.0;
104 v[1] = 2.0;
105 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(
A,
B, C, v) == TriOr::TRIANGLE_INSIDE);
106
107 v[0] = 2;
108 v[1] = 1;
109 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(
A,
B, C, v) == TriOr::TRIANGLE_ONEDGE);
110
111 v[0] = 3;
112 v[1] = 1;
113 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(
A,
B, C, v) == TriOr::TRIANGLE_ONVERTEX);
114
115
118 C = { -16.3299, 0. };
119 v = { -17., 0.};
120 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(
A,
B, C, v) == TriOr::TRIANGLE_OUTSIDE);
121
122
123 A = { -0.891282, 9.91201 };
124 B = { -1.40823, 9.91261 };
125 C = { -1.36963, 9.37414 };
126 v = { -1.16961, 9.83039 };
127 REQUIRE(MeshVoxelizer6::pointIsInside2DTriangle(
A,
B, C, v) == TriOr::TRIANGLE_INSIDE);
128 }
129
130
131 SECTION(
"Test if 3D point is inside voxel")
132 {
133
134 PointR3 P(-0.89, 9.91, 0.86);
135 PointZ3 v(-1, 10, 1);
136
137 REQUIRE(MeshVoxelizer6::pointIsInsideVoxel(P, v) ==
true);
138
139 P[0] = -1.41;
140 P[1] = 9.91;
141 REQUIRE(MeshVoxelizer6::pointIsInsideVoxel(P, v) ==
true);
142
143 P[0] = -1.37;
144 P[1] = 9.37;
145 REQUIRE(MeshVoxelizer6::pointIsInsideVoxel(P, v) ==
false);
146
147 P[0] = -1.17;
148 P[1] = 9.83;
149 P[2] = 0;
150 REQUIRE(MeshVoxelizer6::pointIsInsideVoxel(P, v) ==
false);
151 }
152
153
154 SECTION(
"26-sep voxelization of a single triangle")
155 {
158 MeshVoxelizer26 voxelizer;
159
160 voxelizer.voxelize(outputSet,
Point(5,0,0),
Point(0,5,0),
Point(0,0,5));
161 REQUIRE( outputSet.size() == 46 );
162 }
163
164
165 SECTION(
"6-sep voxelization of a single triangle")
166 {
169 MeshVoxelizer6 voxelizer;
170
171 voxelizer.voxelize(outputSet,
Point(5,0,0),
Point(0,5,0),
Point(0,0,5));
172 REQUIRE( outputSet.size() == 21 );
173 }
174
175
176 SECTION(
"6-sep voxelization of a OFF cube mesh")
177 {
178
183 MeshVoxelizer6 voxelizer;
184
186
187 voxelizer.voxelize(outputSet, inputMesh, 10.0 );
188
190
191 REQUIRE( outputSet.size() == 2562 );
192 }
193
194 SECTION(
"26-sep voxelization of a OFF cube mesh")
195 {
196
201 MeshVoxelizer26 voxelizer;
202
204
205 voxelizer.voxelize(outputSet, inputMesh, 10.0 );
206
208
209 REQUIRE( outputSet.size() == 4162 );
210 }
211}
Aim: Class that implements an orientation functor, ie. it provides a way to compute the orientation o...
Aim: A class for computing the digitization of a triangle or a Mesh.
Aim: This class is defined to represent a surface mesh through a set of vertices and faces....
Aim: Implements basic operations that will be used in Point and Vector classes.
Aim: Small adapter to models of COrientationFunctor2. It is a model of concepts::CPointPredicate....
HyperRectDomain< Space > Domain
DigitalSetSelector< Domain, BIG_DS+HIGH_BEL_DS >::Type DigitalSet
DGtal::LinearOperator< Calculus, dim, duality, dim, duality > diagonal(const DGtal::KForm< Calculus, dim, duality > &kform)
static bool importOFFFile(const std::string &filename, DGtal::Mesh< TPoint > &aMesh, bool invertVertexOrder=false, bool onlyFaceVertex=false)
SECTION("Testing constant forward iterators")
REQUIRE(domain.isInside(aPoint))