Lagrange
Loading...
Searching...
No Matches
Group-utils-geom

Enumerations

enum class  IncludeBoundaryIntersection { No , Yes }
 Controls whether boundary contact counts as intersection in triangle_triangle_intersection(). More...
 

Functions

template<typename Scalar>
bool triangle_triangle_intersection (span< const Scalar, 3 > t1_v0, span< const Scalar, 3 > t1_v1, span< const Scalar, 3 > t1_v2, span< const Scalar, 3 > t2_v0, span< const Scalar, 3 > t2_v1, span< const Scalar, 3 > t2_v2, IncludeBoundaryIntersection boundary=IncludeBoundaryIntersection::No)
 Check if two 3D triangles intersect using exact predicates for robustness.
 

Detailed Description

Enumeration Type Documentation

◆ IncludeBoundaryIntersection

enum class IncludeBoundaryIntersection
strong

#include <lagrange/utils/triangle_triangle_intersection.h>

Controls whether boundary contact counts as intersection in triangle_triangle_intersection().

Enumerator
No 

Only interior intersections count.

Triangles touching at vertices or edges are not considered intersecting.

Yes 

Any contact counts as intersection, including touching at vertices or edges.

Function Documentation

◆ triangle_triangle_intersection()

template<typename Scalar>
bool triangle_triangle_intersection ( span< const Scalar, 3 > t1_v0,
span< const Scalar, 3 > t1_v1,
span< const Scalar, 3 > t1_v2,
span< const Scalar, 3 > t2_v0,
span< const Scalar, 3 > t2_v1,
span< const Scalar, 3 > t2_v2,
IncludeBoundaryIntersection boundary = IncludeBoundaryIntersection::No )

#include <lagrange/utils/triangle_triangle_intersection.h>

Check if two 3D triangles intersect using exact predicates for robustness.

This function uses Shewchuk's exact orient3D and orient2D predicates to robustly determine if two triangles intersect in 3D space. The algorithm tests each edge of one triangle against the other triangle using tetrahedra orientation tests, with special handling for coplanar cases using 2D projections.

Parameters
[in]t1_v0First vertex of triangle 1.
[in]t1_v1Second vertex of triangle 1.
[in]t1_v2Third vertex of triangle 1.
[in]t2_v0First vertex of triangle 2.
[in]t2_v1Second vertex of triangle 2.
[in]t2_v2Third vertex of triangle 2.
[in]boundaryWhether touching at boundaries counts as intersection.
Template Parameters
ScalarThe scalar type (e.g., float, double).
Returns
True if the triangles intersect, false otherwise.
Note
Orientation and coplanarity decisions rely on Shewchuk's exact predicates for robustness. Some auxiliary computations (e.g., projection axis selection and collinear interval parameterization) use standard floating-point arithmetic.