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

Function doTrianglesIntersectExt

source/MRMesh/MRTriangleIntersection.h:272–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

270/// please consider using \ref findTriTriDistance function instead that is more tolerant to floating-point errors but slower
271template <typename T>
272bool doTrianglesIntersectExt(
273 const Vector3<T> & a, const Vector3<T> & b, const Vector3<T> & c,
274 const Vector3<T> & d, const Vector3<T> & e, const Vector3<T> & f
275)
276{
277 if ( !doTrianglesIntersect( a, b, c, d, e, f ) )
278 return false;
279
280 // direction from center to center
281 const auto dir = a + b + c - d - e - f;
282
283 return
284 !doesEdgeXySeparate( a, b, c, d, e, f, dir ) &&
285 !doesEdgeXySeparate( b, c, a, d, e, f, dir ) &&
286 !doesEdgeXySeparate( c, a, b, d, e, f, dir ) &&
287 !doesEdgeXySeparate( d, e, f, a, b, c, dir ) &&
288 !doesEdgeXySeparate( e, f, d, a, b, c, dir ) &&
289 !doesEdgeXySeparate( f, d, e, a, b, c, dir );
290}
291
292/// checks whether triangle ABC and infinite line DE intersect
293template <typename T>

Callers 2

testNoIntersectFunction · 0.85
TESTFunction · 0.85

Calls 2

doTrianglesIntersectFunction · 0.85
doesEdgeXySeparateFunction · 0.85

Tested by 2

testNoIntersectFunction · 0.68
TESTFunction · 0.68