PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
pbat::geometry::OverlapQueries Namespace Reference

This namespace contains functions to answer overlap queries. More...

Functions

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool PointAxisAlignedBoundingBox (TMatrixP const &P, TMatrixL const &L, TMatrixU const &U)
 Tests for overlap between point P and axis-aligned bounding box (L,U)
 
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC>
PBAT_HOST_DEVICE bool PointTriangle (TMatrixP const &P, TMatrixA const &A, TMatrixB const &B, TMatrixC const &C)
 Tests for overlap between point P and triangle ABC.
 
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixD>
PBAT_HOST_DEVICE bool PointTetrahedron3D (TMatrixP const &P, TMatrixA const &A, TMatrixB const &B, TMatrixC const &C, TMatrixD const &D)
 Checks if point P is contained in tetrahedron ABCD, in at least 3D.
 
template<mini::CMatrix TMatrixC1, mini::CMatrix TMatrixC2>
PBAT_HOST_DEVICE bool Spheres (TMatrixC1 const &C1, typename TMatrixC1::ScalarType R1, TMatrixC2 const &C2, typename TMatrixC2::ScalarType R2)
 Tests for overlap between sphere (C1,R1) and sphere (C2,R2).
 
template<mini::CMatrix TMatrixL1, mini::CMatrix TMatrixU1, mini::CMatrix TMatrixL2, mini::CMatrix TMatrixU2>
PBAT_HOST_DEVICE bool AxisAlignedBoundingBoxes (TMatrixL1 const &L1, TMatrixU1 const &U1, TMatrixL2 const &L2, TMatrixU2 const &U2)
 Tests for overlap between axis-aligned bounding box (L1,U1) and axis-aligned bounding box (L2,U2)
 
template<mini::CMatrix TMatrixC, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool SphereAxisAlignedBoundingBox (TMatrixC const &C, typename TMatrixC::ScalarType R, TMatrixL const &L, TMatrixU const &U)
 Tests for overlap between sphere (c,r) and axis-aligned bounding box (low,up)
 
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixC>
PBAT_HOST_DEVICE bool LineSegmentSphere (TMatrixP const &P, TMatrixQ const &Q, TMatrixC const &C, typename TMatrixC::ScalarType R)
 Tests for overlap between line segment PQ and sphere (C,R)
 
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool LineSegmentAxisAlignedBoundingBox (TMatrixP const &P, TMatrixQ const &Q, TMatrixL const &L, TMatrixU const &U)
 Tests for overlap between line segment PQ and axis-aligned bounding box (L,U)
 
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC>
PBAT_HOST_DEVICE bool LineSegmentTriangle3D (TMatrixP const &P, TMatrixQ const &Q, TMatrixA const &A, TMatrixB const &B, TMatrixC const &C)
 Detects if the line segment PQ passes through the triangle ABC, in 3D.
 
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2>
PBAT_HOST_DEVICE bool LineSegmentSweptTriangle3D (TMatrixP const &P, TMatrixQ const &Q, TMatrixA1 const &A1, TMatrixB1 const &B1, TMatrixC1 const &C1, TMatrixA2 const &A2, TMatrixB2 const &B2, TMatrixC2 const &C2)
 Tests overlap between line segment PQ and the swept volume spanned by linear interpolation of A1B1C1 to A2B2C2.
 
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixN, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool PlaneAxisAlignedBoundingBox (TMatrixP const &P, TMatrixN const &n, TMatrixL const &L, TMatrixU const &U)
 Tests for overlap between plane (P,n) and axis-aligned bounding box (low,up)
 
template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool TriangleAxisAlignedBoundingBox (TMatrixA const &A, TMatrixB const &B, TMatrixC const &C, TMatrixL const &L, TMatrixU const &U)
 Tests for overlap between triangle ABC and axis-aligned bounding box (low,up)
 
template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixD, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool TetrahedronAxisAlignedBoundingBox (TMatrixA const &A, TMatrixB const &B, TMatrixC const &C, TMatrixD const &D, TMatrixL const &L, TMatrixU const &U)
 Tests for overlap between tetrahedron ABCD and axis-aligned bounding box (L,U), in at least 3D.
 
template<mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2>
PBAT_HOST_DEVICE bool Triangles2D (TMatrixA1 const &A1, TMatrixB1 const &B1, TMatrixC1 const &C1, TMatrixA2 const &A2, TMatrixB2 const &B2, TMatrixC2 const &C2)
 Tests for overlap between triangle A1B1C1 and triangle A2B2C2, in 2D.
 
template<mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2>
PBAT_HOST_DEVICE bool Triangles3D (TMatrixA1 const &A1, TMatrixB1 const &B1, TMatrixC1 const &C1, TMatrixA2 const &A2, TMatrixB2 const &B2, TMatrixC2 const &C2)
 Tests for overlap between triangle A1B1C1 and triangle A2B2C2, in 3D.
 
template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixI, mini::CMatrix TMatrixJ, mini::CMatrix TMatrixK, mini::CMatrix TMatrixL>
PBAT_HOST_DEVICE bool TriangleTetrahedron (TMatrixA const &A, TMatrixB const &B, TMatrixC const &C, TMatrixI const &I, TMatrixJ const &J, TMatrixK const &K, TMatrixL const &L)
 Tests for overlap between triangle ABC and tetrahedron IJKL, in at least 3D.
 
template<mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixD1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2, mini::CMatrix TMatrixD2>
PBAT_HOST_DEVICE bool Tetrahedra (TMatrixA1 const &A1, TMatrixB1 const &B1, TMatrixC1 const &C1, TMatrixD1 const &D1, TMatrixA2 const &A2, TMatrixB2 const &B2, TMatrixC2 const &C2, TMatrixD2 const &D2)
 Tests for overlap between tetrahedron A1B1C1D1 and tetrahedron A2B2C2D2, in at least 3D.
 
template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixSC>
PBAT_HOST_DEVICE bool TriangleSphere (TMatrixA const &A, TMatrixB const &B, TMatrixC const &C, TMatrixSC const &SC, typename TMatrixSC::ScalarType R)
 Tests for overlap between a triangle ABC and a sphere with center SC of radius R.
 
template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixD, mini::CMatrix TMatrixSC>
PBAT_HOST_DEVICE bool TetrahedronSphere (TMatrixA const &A, TMatrixB const &B, TMatrixC const &C, TMatrixD const &D, TMatrixSC const &SC, typename TMatrixSC::ScalarType R)
 Tests for overlap between a tetrahedron ABCD and a sphere with center SC of radius R.
 

Detailed Description

This namespace contains functions to answer overlap queries.

Function Documentation

◆ AxisAlignedBoundingBoxes()

template<mini::CMatrix TMatrixL1, mini::CMatrix TMatrixU1, mini::CMatrix TMatrixL2, mini::CMatrix TMatrixU2>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::AxisAlignedBoundingBoxes ( TMatrixL1 const & L1,
TMatrixU1 const & U1,
TMatrixL2 const & L2,
TMatrixU2 const & U2 )

Tests for overlap between axis-aligned bounding box (L1,U1) and axis-aligned bounding box (L2,U2)

Template Parameters
TMatrixL1Matrix type of the lower bound of AABB 1
TMatrixU1Matrix type of the upper bound of AABB 1
TMatrixL2Matrix type of the lower bound of AABB 2
TMatrixU2Matrix type of the upper bound of AABB 2
Parameters
L1The lower bound of AABB 1
U1The upper bound of AABB 1
L2The lower bound of AABB 2
U2The upper bound of AABB 2
Returns
True if the AABBs overlap, false otherwise

◆ LineSegmentAxisAlignedBoundingBox()

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::LineSegmentAxisAlignedBoundingBox ( TMatrixP const & P,
TMatrixQ const & Q,
TMatrixL const & L,
TMatrixU const & U )

Tests for overlap between line segment PQ and axis-aligned bounding box (L,U)

Template Parameters
TMatrixPStart point matrix type
TMatrixQEnd point matrix type
TMatrixLLower corner matrix type
TMatrixUUpper corner matrix type
Parameters
PStart point of the line segment
QEnd point of the line segment
LLower corner of the box
UUpper corner of the box
Returns
True if the line segment and box overlap, false otherwise

◆ LineSegmentSphere()

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixC>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::LineSegmentSphere ( TMatrixP const & P,
TMatrixQ const & Q,
TMatrixC const & C,
typename TMatrixC::ScalarType R )

Tests for overlap between line segment PQ and sphere (C,R)

Template Parameters
TMatrixPStart point matrix type
TMatrixQEnd point matrix type
TMatrixCCenter matrix type
Parameters
PStart point of the line segment
QEnd point of the line segment
CCenter of the sphere
RRadius of the sphere
Returns
True if the line segment and sphere overlap, false otherwise

◆ LineSegmentSweptTriangle3D()

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::LineSegmentSweptTriangle3D ( TMatrixP const & P,
TMatrixQ const & Q,
TMatrixA1 const & A1,
TMatrixB1 const & B1,
TMatrixC1 const & C1,
TMatrixA2 const & A2,
TMatrixB2 const & B2,
TMatrixC2 const & C2 )

Tests overlap between line segment PQ and the swept volume spanned by linear interpolation of A1B1C1 to A2B2C2.

Warning
This function does not handle degeneracies yet. I don't suggest using it for now.
Template Parameters
TMatrixPStart point matrix type
TMatrixQEnd point matrix type
TMatrixA1Matrix type of the vertex A1 of triangle 1
TMatrixB1Matrix type of the vertex B1 of triangle 1
TMatrixC1Matrix type of the vertex C1 of triangle 1
TMatrixA2Matrix type of the vertex A2 of triangle 2
TMatrixB2Matrix type of the vertex B2 of triangle 2
TMatrixC2Matrix type of the vertex C2 of triangle 2
Parameters
PStart point of the line segment
QEnd point of the line segment
A1Vertex A of triangle 1
B1Vertex B of triangle 1
C1Vertex C of triangle 1
A2Vertex A of triangle 2
B2Vertex B of triangle 2
C2Vertex C of triangle 2
Returns
True if the line segment passes through the swept volume, false otherwise

◆ LineSegmentTriangle3D()

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::LineSegmentTriangle3D ( TMatrixP const & P,
TMatrixQ const & Q,
TMatrixA const & A,
TMatrixB const & B,
TMatrixC const & C )

Detects if the line segment PQ passes through the triangle ABC, in 3D.

Template Parameters
TMatrixPMatrix type of the start point of the line segment
TMatrixQMatrix type of the end point of the line segment
TMatrixAMatrix type of the vertex A of the triangle
TMatrixBMatrix type of the vertex B of the triangle
TMatrixCMatrix type of the vertex C of the triangle
Parameters
PStart point of the line segment
QEnd point of the line segment
AVertex A of the triangle
BVertex B of the triangle
CVertex C of the triangle
Returns
True if the line segment passes through the triangle, false otherwise

◆ PlaneAxisAlignedBoundingBox()

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixN, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::PlaneAxisAlignedBoundingBox ( TMatrixP const & P,
TMatrixN const & n,
TMatrixL const & L,
TMatrixU const & U )

Tests for overlap between plane (P,n) and axis-aligned bounding box (low,up)

Template Parameters
TMatrixPPoint on the plane matrix type
TMatrixNNormal of the plane matrix type
TMatrixLLower corner matrix type
TMatrixUUpper corner matrix type
Parameters
PPoint on the plane
nNormal of the plane
LLower corner of the box
UUpper corner of the box
Returns
True if the plane and box overlap, false otherwise

◆ PointAxisAlignedBoundingBox()

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::PointAxisAlignedBoundingBox ( TMatrixP const & P,
TMatrixL const & L,
TMatrixU const & U )

Tests for overlap between point P and axis-aligned bounding box (L,U)

Template Parameters
TMatrixPPoint matrix type
TMatrixLLower corner matrix type
TMatrixUUpper corner matrix type
Parameters
PPoint
LLower corner of the box
UUpper corner of the box
Returns
True if P is inside the box, false otherwise

◆ PointTetrahedron3D()

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixD>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::PointTetrahedron3D ( TMatrixP const & P,
TMatrixA const & A,
TMatrixB const & B,
TMatrixC const & C,
TMatrixD const & D )

Checks if point P is contained in tetrahedron ABCD, in at least 3D.

Template Parameters
TMatrixPPoint matrix type
TMatrixAVertex A matrix type
TMatrixBVertex B matrix type
TMatrixCVertex C matrix type
TMatrixDVertex D matrix type
Parameters
PPoint
AVertex A of the tetrahedron
BVertex B of the tetrahedron
CVertex C of the tetrahedron
DVertex D of the tetrahedron
Returns
True if P is inside the tetrahedron, false otherwise

◆ PointTriangle()

template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::PointTriangle ( TMatrixP const & P,
TMatrixA const & A,
TMatrixB const & B,
TMatrixC const & C )

Tests for overlap between point P and triangle ABC.

Template Parameters
TMatrixPPoint matrix type
TMatrixAVertex A matrix type
TMatrixBVertex B matrix type
TMatrixCVertex C matrix type
Parameters
PPoint
AVertex A of the triangle
BVertex B of the triangle
CVertex C of the triangle
Returns
True if P is inside the triangle, false otherwise

◆ SphereAxisAlignedBoundingBox()

template<mini::CMatrix TMatrixC, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::SphereAxisAlignedBoundingBox ( TMatrixC const & C,
typename TMatrixC::ScalarType R,
TMatrixL const & L,
TMatrixU const & U )

Tests for overlap between sphere (c,r) and axis-aligned bounding box (low,up)

Template Parameters
TMatrixCCenter matrix type of the sphere
TMatrixLLower corner matrix type of the box
TMatrixUUpper corner matrix type of the box
Parameters
CCenter of the sphere
RRadius of the sphere
LLower corner of the box
UUpper corner of the box
Returns
True if the sphere and box overlap, false otherwise

◆ Spheres()

template<mini::CMatrix TMatrixC1, mini::CMatrix TMatrixC2>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::Spheres ( TMatrixC1 const & C1,
typename TMatrixC1::ScalarType R1,
TMatrixC2 const & C2,
typename TMatrixC2::ScalarType R2 )

Tests for overlap between sphere (C1,R1) and sphere (C2,R2).

Template Parameters
TMatrixC1Center matrix type of the first sphere
TMatrixC2Center matrix type of the second sphere
Parameters
C1Center of the first sphere
R1Radius of the first sphere
C2Center of the second sphere
R2Radius of the second sphere
Returns
True if the spheres overlap, false otherwise

◆ Tetrahedra()

template<mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixD1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2, mini::CMatrix TMatrixD2>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::Tetrahedra ( TMatrixA1 const & A1,
TMatrixB1 const & B1,
TMatrixC1 const & C1,
TMatrixD1 const & D1,
TMatrixA2 const & A2,
TMatrixB2 const & B2,
TMatrixC2 const & C2,
TMatrixD2 const & D2 )

Tests for overlap between tetrahedron A1B1C1D1 and tetrahedron A2B2C2D2, in at least 3D.

Template Parameters
TMatrixA1Matrix type of vertex A1 of tetrahedron 1
TMatrixB1Matrix type of vertex B1 of tetrahedron 1
TMatrixC1Matrix type of vertex C1 of tetrahedron 1
TMatrixD1Matrix type of vertex D1 of tetrahedron 1
TMatrixA2Matrix type of vertex A2 of tetrahedron 2
TMatrixB2Matrix type of vertex B2 of tetrahedron 2
TMatrixC2Matrix type of vertex C2 of tetrahedron 2
TMatrixD2Matrix type of vertex D2 of tetrahedron 2
Parameters
A1Vertex A of tetrahedron 1
B1Vertex B of tetrahedron 1
C1Vertex C of tetrahedron 1
D1Vertex D of tetrahedron 1
A2Vertex A of tetrahedron 2
B2Vertex B of tetrahedron 2
C2Vertex C of tetrahedron 2
D2Vertex D of tetrahedron 2
Returns
True if the tetrahedra overlap, false otherwise

◆ TetrahedronAxisAlignedBoundingBox()

template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixD, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::TetrahedronAxisAlignedBoundingBox ( TMatrixA const & A,
TMatrixB const & B,
TMatrixC const & C,
TMatrixD const & D,
TMatrixL const & L,
TMatrixU const & U )

Tests for overlap between tetrahedron ABCD and axis-aligned bounding box (L,U), in at least 3D.

Template Parameters
TMatrixAVertex A matrix type
TMatrixBVertex B matrix type
TMatrixCVertex C matrix type
TMatrixDVertex D matrix type
TMatrixLLower corner matrix type
TMatrixUUpper corner matrix type
Parameters
AVertex A of the tetrahedron
BVertex B of the tetrahedron
CVertex C of the tetrahedron
DVertex D of the tetrahedron
LLower corner of the box
UUpper corner of the box
Returns
True if the tetrahedron and box overlap, false otherwise

Our implementation is super inefficient for AABBs, because of all the known zeros that we are not exploiting. Because AABBs are axis aligned, their edges have many zeros, and cross product and dot product operations with these edges could save many floating point operations, but we don't do it... Fortunately, this implementation is valid for OBBs.

◆ TetrahedronSphere()

template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixD, mini::CMatrix TMatrixSC>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::TetrahedronSphere ( TMatrixA const & A,
TMatrixB const & B,
TMatrixC const & C,
TMatrixD const & D,
TMatrixSC const & SC,
typename TMatrixSC::ScalarType R )

Tests for overlap between a tetrahedron ABCD and a sphere with center SC of radius R.

Template Parameters
TMatrixAVertex A matrix type
TMatrixBVertex B matrix type
TMatrixCVertex C matrix type
TMatrixDVertex D matrix type
TMatrixSCCenter matrix type of the sphere
Parameters
AVertex A of the tetrahedron
BVertex B of the tetrahedron
CVertex C of the tetrahedron
DVertex D of the tetrahedron
SCCenter of the sphere
RRadius of the sphere
Returns
True if the tetrahedron and sphere overlap, false otherwise

◆ TriangleAxisAlignedBoundingBox()

template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixL, mini::CMatrix TMatrixU>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::TriangleAxisAlignedBoundingBox ( TMatrixA const & A,
TMatrixB const & B,
TMatrixC const & C,
TMatrixL const & L,
TMatrixU const & U )

Tests for overlap between triangle ABC and axis-aligned bounding box (low,up)

Template Parameters
TMatrixAVertex A matrix type
TMatrixBVertex B matrix type
TMatrixCVertex C matrix type
TMatrixLLower corner matrix type
TMatrixUUpper corner matrix type
Parameters
AVertex A of the triangle
BVertex B of the triangle
CVertex C of the triangle
LLower corner of the box
UUpper corner of the box
Returns
True if the triangle and box overlap, false otherwise

See [5] section 5.2.9

Our implementation is super inefficient for AABBs, because of all the known zeros that we are not exploiting. Because AABBs are axis aligned, their edges have many zeros, and cross product and dot product operations with these edges could save many floating point operations, but we don't do it... Fortunately, this implementation is valid for OBBs.

◆ Triangles2D()

template<mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::Triangles2D ( TMatrixA1 const & A1,
TMatrixB1 const & B1,
TMatrixC1 const & C1,
TMatrixA2 const & A2,
TMatrixB2 const & B2,
TMatrixC2 const & C2 )

Tests for overlap between triangle A1B1C1 and triangle A2B2C2, in 2D.

Template Parameters
TMatrixA1Matrix type of vertex A1 of triangle 1
TMatrixB1Matrix type of vertex B1 of triangle 1
TMatrixC1Matrix type of vertex C1 of triangle 1
TMatrixA2Matrix type of vertex A2 of triangle 2
TMatrixB2Matrix type of vertex B2 of triangle 2
TMatrixC2Matrix type of vertex C2 of triangle 2
Parameters
A1Vertex A of triangle 1
B1Vertex B of triangle 1
C1Vertex C of triangle 1
A2Vertex A of triangle 2
B2Vertex B of triangle 2
C2Vertex C of triangle 2
Returns
True if the triangles overlap, false otherwise

◆ Triangles3D()

template<mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::Triangles3D ( TMatrixA1 const & A1,
TMatrixB1 const & B1,
TMatrixC1 const & C1,
TMatrixA2 const & A2,
TMatrixB2 const & B2,
TMatrixC2 const & C2 )

Tests for overlap between triangle A1B1C1 and triangle A2B2C2, in 3D.

Template Parameters
TMatrixA1Matrix type of vertex A1 of triangle 1
TMatrixB1Matrix type of vertex B1 of triangle 1
TMatrixC1Matrix type of vertex C1 of triangle 1
TMatrixA2Matrix type of vertex A2 of triangle 2
TMatrixB2Matrix type of vertex B2 of triangle 2
TMatrixC2Matrix type of vertex C2 of triangle 2
Parameters
A1Vertex A of triangle 1
B1Vertex B of triangle 1
C1Vertex C of triangle 1
A2Vertex A of triangle 2
B2Vertex B of triangle 2
C2Vertex C of triangle 2
Returns
True if the triangles overlap, false otherwise

◆ TriangleSphere()

template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixSC>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::TriangleSphere ( TMatrixA const & A,
TMatrixB const & B,
TMatrixC const & C,
TMatrixSC const & SC,
typename TMatrixSC::ScalarType R )

Tests for overlap between a triangle ABC and a sphere with center SC of radius R.

Template Parameters
TMatrixAVertex A matrix type
TMatrixBVertex B matrix type
TMatrixCVertex C matrix type
TMatrixSCCenter matrix type of the sphere
Parameters
AVertex A of the triangle
BVertex B of the triangle
CVertex C of the triangle
SCCenter of the sphere
RRadius of the sphere
Returns
True if the triangle and sphere overlap, false otherwise

◆ TriangleTetrahedron()

template<mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC, mini::CMatrix TMatrixI, mini::CMatrix TMatrixJ, mini::CMatrix TMatrixK, mini::CMatrix TMatrixL>
PBAT_HOST_DEVICE bool pbat::geometry::OverlapQueries::TriangleTetrahedron ( TMatrixA const & A,
TMatrixB const & B,
TMatrixC const & C,
TMatrixI const & I,
TMatrixJ const & J,
TMatrixK const & K,
TMatrixL const & L )

Tests for overlap between triangle ABC and tetrahedron IJKL, in at least 3D.

Template Parameters
TMatrixAMatrix type of vertex A of the triangle
TMatrixBMatrix type of vertex B of the triangle
TMatrixCMatrix type of vertex C of the triangle
TMatrixIMatrix type of vertex I of the tetrahedron
TMatrixJMatrix type of vertex J of the tetrahedron
TMatrixKMatrix type of vertex K of the tetrahedron
TMatrixLMatrix type of vertex L of the tetrahedron
Parameters
AVertex A of the triangle
BVertex B of the triangle
CVertex C of the triangle
IVertex I of the tetrahedron
JVertex J of the tetrahedron
KVertex K of the tetrahedron
LVertex L of the tetrahedron
Returns
True if the triangle and tetrahedron overlap, false otherwise