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
EdgeEdgeCcd.h File Reference

Edge-edge continuous collision detection (CCD) implementation. More...

#include "pbat/HostDevice.h"
#include "pbat/geometry/ClosestPointQueries.h"
#include "pbat/math/linalg/mini/Concepts.h"
#include "pbat/math/linalg/mini/Matrix.h"
#include "pbat/math/linalg/mini/Reductions.h"
#include "pbat/math/polynomial/Roots.h"
#include <array>
#include <cmath>

Go to the source code of this file.

Namespaces

namespace  pbat
 The main namespace of the library.
 
namespace  pbat::geometry
 Geometric queries, quantities and data structures.
 

Functions

template<math::linalg::mini::CReadableVectorizedMatrix TP1T, math::linalg::mini::CReadableVectorizedMatrix TQ1T, math::linalg::mini::CReadableVectorizedMatrix TP2T, math::linalg::mini::CReadableVectorizedMatrix TQ2T, math::linalg::mini::CReadableVectorizedMatrix TP1, math::linalg::mini::CReadableVectorizedMatrix TQ1, math::linalg::mini::CReadableVectorizedMatrix TP2, math::linalg::mini::CReadableVectorizedMatrix TQ2, class TScalar = typename TP1T::ScalarType>
PBAT_HOST_DEVICE std::array< TScalar, 4 > pbat::geometry::detail::EdgeEdgeCcdUnivariatePolynomial (TP1T const &P1T, TQ1T const &Q1T, TP2T const &P2T, TQ2T const &Q2T, TP1 const &P1, TQ1 const &Q1, TP2 const &P2, TQ2 const &Q2)
 Computes the univariate linearly swept edge-edge co-planarity polynomial.
 
template<math::linalg::mini::CReadableVectorizedMatrix TP1T, math::linalg::mini::CReadableVectorizedMatrix TQ1T, math::linalg::mini::CReadableVectorizedMatrix TP2T, math::linalg::mini::CReadableVectorizedMatrix TQ2T, math::linalg::mini::CReadableVectorizedMatrix TP1, math::linalg::mini::CReadableVectorizedMatrix TQ1, math::linalg::mini::CReadableVectorizedMatrix TP2, math::linalg::mini::CReadableVectorizedMatrix TQ2, class TScalar = typename TP1T::ScalarType>
PBAT_HOST_DEVICE auto pbat::geometry::EdgeEdgeCcd (TP1T const &P1T, TQ1T const &Q1T, TP2T const &P2T, TQ2T const &Q2T, TP1 const &P1, TQ1 const &Q1, TP2 const &P2, TQ2 const &Q2) -> math::linalg::mini::SVector< TScalar, 3 >
 Computes the time of impact \( t^* \) and barycentric coordinates \( \mathbf{\beta} \) of the intersection point between an edge \( (P1,Q1) \) and another edge \( (P2,Q2) \) moving along a linear trajectory.
 

Detailed Description

Edge-edge continuous collision detection (CCD) implementation.

Author
Quoc-Minh Ton-That (tonth.nosp@m.at.q.nosp@m.uocmi.nosp@m.nh@g.nosp@m.mail..nosp@m.com)
Date
2025-03-27

Function Documentation

◆ EdgeEdgeCcdUnivariatePolynomial()

template<math::linalg::mini::CReadableVectorizedMatrix TP1T, math::linalg::mini::CReadableVectorizedMatrix TQ1T, math::linalg::mini::CReadableVectorizedMatrix TP2T, math::linalg::mini::CReadableVectorizedMatrix TQ2T, math::linalg::mini::CReadableVectorizedMatrix TP1, math::linalg::mini::CReadableVectorizedMatrix TQ1, math::linalg::mini::CReadableVectorizedMatrix TP2, math::linalg::mini::CReadableVectorizedMatrix TQ2, class TScalar = typename TP1T::ScalarType>
PBAT_HOST_DEVICE std::array< TScalar, 4 > pbat::geometry::detail::EdgeEdgeCcdUnivariatePolynomial ( TP1T const & P1T,
TQ1T const & Q1T,
TP2T const & P2T,
TQ2T const & Q2T,
TP1 const & P1,
TQ1 const & Q1,
TP2 const & P2,
TQ2 const & Q2 )

Computes the univariate linearly swept edge-edge co-planarity polynomial.

\[\langle \mathbf{n}(t), \mathbf{q}(t) \rangle = 0 , \]

where \( \mathbf{n}(t) = (\mathbf{q}_1(t) - \mathbf{p}_1(t)) \times (\mathbf{q}_2(t) - \mathbf{p}_2(t)) \) and \( \mathbf{q}(t) = \mathbf{x}(t) - \mathbf{p}_1(t) \)

Note
Code-generated from python/geometry/ccd.py
Template Parameters
TP1TType of the input matrix P1T
TQ1TType of the input matrix Q1T
TP2TType of the input matrix P2T
TQ2TType of the input matrix Q2T
TP1Type of the input matrix P1
TQ1Type of the input matrix Q1
TP2Type of the input matrix P2
TQ2Type of the input matrix Q2
TScalarType of the scalar
Parameters
P1TMatrix of the initial positions of the point P on edge 1
Q1TMatrix of the initial positions of the point Q on edge 1
P2TMatrix of the initial positions of the point P on edge 2
Q2TMatrix of the initial positions of the point Q on edge 2
P1Matrix of the final positions of the point P on edge 1
Q1Matrix of the final positions of the point Q on edge 1
P2Matrix of the final positions of the point P on edge 2
Q2Matrix of the final positions of the point Q on edge 2
Returns
4-vector containing the coefficients of the polynomial in increasing order