MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / test_tetrahedron

Function test_tetrahedron

tests/geometry/test-basic-objects.cpp:183–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183void test_tetrahedron()
184{
185 const geode::Point3D a{ { 1.0, 5.0 } };
186 const geode::Point3D b{ { -1.0, -5.0 } };
187 const geode::Point3D c{ { 1.0, -5.0 } };
188 const geode::Point3D d{ { -1.0, 5.0 } };
189 const geode::Tetrahedron tetra{ a, b, c, d };
190
191 const geode::Point3D barycenter{ { 0, 0 } };
192 geode::OpenGeodeGeometryException::test(
193 tetra.barycenter() == barycenter, "Wrong barycenter result" );
194
195 geode::Tetrahedron tetra2{ tetra };
196 geode::OpenGeodeGeometryException::test(
197 tetra2.vertices()[0].get() == a && tetra2.vertices()[1].get() == b
198 && tetra2.vertices()[2].get() == c
199 && tetra2.vertices()[3].get() == d,
200 "Wrong result for tetra2" );
201
202 geode::Tetrahedron tetra3{ std::move( tetra ) };
203 geode::OpenGeodeGeometryException::test(
204 tetra3.vertices()[0].get() == a && tetra3.vertices()[1].get() == b
205 && tetra3.vertices()[2].get() == c
206 && tetra2.vertices()[3].get() == d,
207 "Wrong result for tetra3" );
208
209 geode::Tetrahedron tetra4{ d, c, b, a };
210 tetra4 = tetra2;
211 geode::OpenGeodeGeometryException::test(
212 tetra4.vertices()[0].get() == a && tetra4.vertices()[1].get() == b
213 && tetra4.vertices()[2].get() == c
214 && tetra2.vertices()[3].get() == d,
215 "Wrong result for tetra4" );
216
217 geode::Tetrahedron tetra5{ d, c, b, a };
218 tetra5 = std::move( tetra2 );
219 geode::OpenGeodeGeometryException::test(
220 tetra5.vertices()[0].get() == a && tetra5.vertices()[1].get() == b
221 && tetra2.vertices()[2].get() == c
222 && tetra2.vertices()[3].get() == d,
223 "Wrong result for tetra5" );
224}
225
226void test_sphere()
227{

Callers 1

testFunction · 0.85

Calls 3

testFunction · 0.70
barycenterMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected