MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / testNoIntersect

Function testNoIntersect

source/MRTest/MRTriangleIntersectionTests.cpp:195–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193) );
194
195static void testNoIntersect( const Vector3f (&triA)[3], const Vector3f (&triB)[3], bool ext = false )
196{
197 for ( const auto& orderA : triPermutations )
198 {
199 for ( const auto& orderB : triPermutations )
200 {
201 const auto& a = triA[orderA[0]];
202 const auto& b = triA[orderA[1]];
203 const auto& c = triA[orderA[2]];
204 const auto& d = triB[orderB[0]];
205 const auto& e = triB[orderB[1]];
206 const auto& f = triB[orderB[2]];
207
208 if ( ext )
209 {
210 EXPECT_FALSE( doTrianglesIntersectExt( Vector3d{a}, Vector3d{b}, Vector3d{c}, Vector3d{d}, Vector3d{e}, Vector3d{f} ) );
211 EXPECT_FALSE( doTrianglesIntersectExt( Vector3d{d}, Vector3d{e}, Vector3d{f}, Vector3d{a}, Vector3d{b}, Vector3d{c} ) );
212
213 EXPECT_FALSE( doTrianglesIntersectExt( a, b, c, d, e, f ) );
214 EXPECT_FALSE( doTrianglesIntersectExt( d, e, f, a, b, c ) );
215 }
216 else
217 {
218 EXPECT_FALSE( doTrianglesIntersect( Vector3d{a}, Vector3d{b}, Vector3d{c}, Vector3d{d}, Vector3d{e}, Vector3d{f} ) );
219 EXPECT_FALSE( doTrianglesIntersect( Vector3d{d}, Vector3d{e}, Vector3d{f}, Vector3d{a}, Vector3d{b}, Vector3d{c} ) );
220
221 EXPECT_FALSE( doTrianglesIntersect( a, b, c, d, e, f ) );
222 EXPECT_FALSE( doTrianglesIntersect( d, e, f, a, b, c ) );
223 }
224
225 EXPECT_GT( findTriTriDistance( { Vector3d{a}, Vector3d{b}, Vector3d{c} }, { Vector3d{d}, Vector3d{e}, Vector3d{f} } ).distSq, 0 );
226 EXPECT_GT( findTriTriDistance( { a, b, c }, { d, e, f } ).distSq, 0 );
227 }
228 }
229}
230
231TEST( MRMesh, DegenerateTrianglesIntersect )
232{

Callers 1

TESTFunction · 0.85

Calls 3

doTrianglesIntersectExtFunction · 0.85
doTrianglesIntersectFunction · 0.85
findTriTriDistanceFunction · 0.85

Tested by

no test coverage detected