PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
|
This namespace contains functions to answer intersection queries. More...
Functions | |
template<mini::CMatrix TMatrixAP, mini::CMatrix TMatrixAB, mini::CMatrix TMatrixAC> | |
PBAT_HOST_DEVICE auto | TriangleBarycentricCoordinates (TMatrixAP const &AP, TMatrixAB const &AB, TMatrixAC const &AC) -> mini::SMatrix< typename TMatrixAP::ScalarType, 3, 1 > |
Computes the barycentric coordinates of point P with respect to the triangle spanned by vertices A, B, and C. | |
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC> | |
PBAT_HOST_DEVICE auto | TriangleBarycentricCoordinates (TMatrixP const &P, TMatrixA const &A, TMatrixB const &B, TMatrixC const &C) -> mini::SVector< typename TMatrixP::ScalarType, 3 > |
Computes the barycentric coordinates of point P with respect to the triangle spanned by vertices A, B, and C. | |
template<mini::CMatrix TMatrixL1, mini::CMatrix TMatrixU1, mini::CMatrix TMatrixL2, mini::CMatrix TMatrixU2> | |
PBAT_HOST_DEVICE auto | AxisAlignedBoundingBoxes (TMatrixL1 const &L1, TMatrixU1 const &U1, TMatrixL2 const &L2, TMatrixU2 const &U2) -> mini::SMatrix< typename TMatrixL1::ScalarType, TMatrixL1::Rows, 2 > |
Computes the intersection volume between 2 axis aligned bounding boxes. | |
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixC> | |
PBAT_HOST_DEVICE auto | LineSegmentSphere (TMatrixP const &P, TMatrixQ const &Q, TMatrixC const &C, typename TMatrixC::ScalarType R) -> std::optional< mini::SVector< typename TMatrixP::ScalarType, TMatrixP::kRows > > |
Computes the intersection point, if any, between a line segment PQ and a sphere (C,r). | |
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC> | |
PBAT_HOST_DEVICE auto | LineSegmentPlane3D (TMatrixP const &P, TMatrixQ const &Q, TMatrixA const &A, TMatrixB const &B, TMatrixC const &C) -> std::optional< mini::SVector< typename TMatrixP::ScalarType, TMatrixP::kRows > > |
Computes the intersection point, if any, between a line including points P,Q and the plane spanned by triangle ABC, in 3D. | |
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixN> | |
PBAT_HOST_DEVICE auto | LineSegmentPlane3D (TMatrixP const &P, TMatrixQ const &Q, TMatrixN const &n, typename TMatrixN::ScalarType d) -> std::optional< mini::SVector< typename TMatrixP::ScalarType, TMatrixP::kRows > > |
Computes the intersection point, if any, between a line including points P,Q and the plane (n,d), in 3D. | |
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC> | |
PBAT_HOST_DEVICE auto | UvwLineTriangle3D (TMatrixP const &P, TMatrixQ const &Q, TMatrixA const &A, TMatrixB const &B, TMatrixC const &C) -> std::optional< mini::SVector< typename TMatrixP::ScalarType, 3 > > |
Computes the intersection point, if any, between a line including points P,Q and a triangle ABC, in 3D. | |
template<mini::CMatrix TMatrixP, mini::CMatrix TMatrixQ, mini::CMatrix TMatrixA, mini::CMatrix TMatrixB, mini::CMatrix TMatrixC> | |
PBAT_HOST_DEVICE auto | UvwLineSegmentTriangle3D (TMatrixP const &P, TMatrixQ const &Q, TMatrixA const &A, TMatrixB const &B, TMatrixC const &C) -> std::optional< mini::SVector< typename TMatrixP::ScalarType, 4 > > |
Computes the intersection point, if any, between a line segment delimited by points P,Q and a triangle ABC, in 3D. | |
template<mini::CMatrix TMatrixA1, mini::CMatrix TMatrixB1, mini::CMatrix TMatrixC1, mini::CMatrix TMatrixA2, mini::CMatrix TMatrixB2, mini::CMatrix TMatrixC2> | |
PBAT_HOST_DEVICE auto | UvwTriangles3D (TMatrixA1 const &A1, TMatrixB1 const &B1, TMatrixC1 const &C1, TMatrixA2 const &A2, TMatrixB2 const &B2, TMatrixC2 const &C2) -> std::array< std::optional< mini::SVector< typename TMatrixA1::ScalarType, 3 > >, 6u > |
Computes intersection points between 3 edges (as line segments) of triangle A1B1C1 and triangle A2B2C2, and intersection points between 3 edges (as line segments) of triangle A2B2C2 and triangle A1B1C1, in 3D. | |
This namespace contains functions to answer intersection queries.
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::AxisAlignedBoundingBoxes | ( | TMatrixL1 const & | L1, |
TMatrixU1 const & | U1, | ||
TMatrixL2 const & | L2, | ||
TMatrixU2 const & | U2 ) -> mini::SMatrix<typename TMatrixL1::ScalarType, TMatrixL1::Rows, 2> |
Computes the intersection volume between 2 axis aligned bounding boxes.
TMatrixL1 | Matrix type of the lower bound of AABB 1 |
TMatrixU1 | Matrix type of the upper bound of AABB 1 |
TMatrixL2 | Matrix type of the lower bound of AABB 2 |
TMatrixU2 | Matrix type of the upper bound of AABB 2 |
L1 | The lower bound of AABB 1 |
U1 | The upper bound of AABB 1 |
L2 | The lower bound of AABB 2 |
U2 | The upper bound of AABB 2 |
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::LineSegmentPlane3D | ( | TMatrixP const & | P, |
TMatrixQ const & | Q, | ||
TMatrixA const & | A, | ||
TMatrixB const & | B, | ||
TMatrixC const & | C ) -> std::optional<mini::SVector<typename TMatrixP::ScalarType, TMatrixP::kRows>> |
Computes the intersection point, if any, between a line including points P,Q and the plane spanned by triangle ABC, in 3D.
TMatrixP | Matrix type of the point P |
TMatrixQ | Matrix type of the point Q |
TMatrixA | Matrix type of the vertex A |
TMatrixB | Matrix type of the vertex B |
TMatrixC | Matrix type of the vertex C |
P | The start point of the line |
Q | The end point of the line |
A | Vertex A of the triangle |
B | Vertex B of the triangle |
C | Vertex C of the triangle |
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::LineSegmentPlane3D | ( | TMatrixP const & | P, |
TMatrixQ const & | Q, | ||
TMatrixN const & | n, | ||
typename TMatrixN::ScalarType | d ) -> std::optional<mini::SVector<typename TMatrixP::ScalarType, TMatrixP::kRows>> |
Computes the intersection point, if any, between a line including points P,Q and the plane (n,d), in 3D.
TMatrixP | Matrix type of the point P |
TMatrixQ | Matrix type of the point Q |
TMatrixN | Matrix type of the normal vector of the plane |
P | The start point of the line |
Q | The end point of the line |
n | The normal vector of the plane |
d | The distance from the origin to the plane |
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::LineSegmentSphere | ( | TMatrixP const & | P, |
TMatrixQ const & | Q, | ||
TMatrixC const & | C, | ||
typename TMatrixC::ScalarType | R ) -> std::optional<mini::SVector<typename TMatrixP::ScalarType, TMatrixP::kRows>> |
Computes the intersection point, if any, between a line segment PQ and a sphere (C,r).
If there are 2 intersection points, returns the one closest to P along PQ.
P | The start point of the line segment |
Q | The end point of the line segment |
C | The center of the sphere |
R | The radius of the sphere |
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::TriangleBarycentricCoordinates | ( | TMatrixAP const & | AP, |
TMatrixAB const & | AB, | ||
TMatrixAC const & | AC ) -> mini::SMatrix<typename TMatrixAP::ScalarType, 3, 1> |
Computes the barycentric coordinates of point P with respect to the triangle spanned by vertices A, B, and C.
TMatrixAP | Matrix type of the vector from A to P |
TMatrixAB | Matrix type of the vector from A to B |
TMatrixAC | Matrix type of the vector from A to C |
AP | The vector from A to P |
AB | The vector from A to B |
AC | The vector from A to C |
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::TriangleBarycentricCoordinates | ( | TMatrixP const & | P, |
TMatrixA const & | A, | ||
TMatrixB const & | B, | ||
TMatrixC const & | C ) -> mini::SVector<typename TMatrixP::ScalarType, 3> |
Computes the barycentric coordinates of point P with respect to the triangle spanned by vertices A, B, and C.
TMatrixP | Matrix type of the point P |
TMatrixA | Matrix type of the vertex A |
TMatrixB | Matrix type of the vertex B |
TMatrixC | Matrix type of the vertex C |
P | Point from which to compute barycentric coordinates. |
A | Vertex A of the triangle |
B | Vertex B of the triangle |
C | Vertex C of the triangle |
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::UvwLineSegmentTriangle3D | ( | TMatrixP const & | P, |
TMatrixQ const & | Q, | ||
TMatrixA const & | A, | ||
TMatrixB const & | B, | ||
TMatrixC const & | C ) -> std::optional<mini::SVector<typename TMatrixP::ScalarType, 4>> |
Computes the intersection point, if any, between a line segment delimited by points P,Q and a triangle ABC, in 3D.
TMatrixP | Matrix type of the point P |
TMatrixQ | Matrix type of the point Q |
TMatrixA | Matrix type of the vertex A |
TMatrixB | Matrix type of the vertex B |
TMatrixC | Matrix type of the vertex C |
P | The start point of the line segment |
Q | The end point of the line segment |
A | Vertex A of the triangle |
B | Vertex B of the triangle |
C | Vertex C of the triangle |
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::UvwLineTriangle3D | ( | TMatrixP const & | P, |
TMatrixQ const & | Q, | ||
TMatrixA const & | A, | ||
TMatrixB const & | B, | ||
TMatrixC const & | C ) -> std::optional<mini::SVector<typename TMatrixP::ScalarType, 3>> |
Computes the intersection point, if any, between a line including points P,Q and a triangle ABC, in 3D.
TMatrixP | Matrix type of the point P |
TMatrixQ | Matrix type of the point Q |
TMatrixA | Matrix type of the vertex A |
TMatrixB | Matrix type of the vertex B |
TMatrixC | Matrix type of the vertex C |
P | The start point of the line |
Q | The end point of the line |
A | Vertex A of the triangle |
B | Vertex B of the triangle |
C | Vertex C of the triangle |
See [5] section 5.3.4
PBAT_HOST_DEVICE auto pbat::geometry::IntersectionQueries::UvwTriangles3D | ( | TMatrixA1 const & | A1, |
TMatrixB1 const & | B1, | ||
TMatrixC1 const & | C1, | ||
TMatrixA2 const & | A2, | ||
TMatrixB2 const & | B2, | ||
TMatrixC2 const & | C2 ) -> std::array<std::optional<mini::SVector<typename TMatrixA1::ScalarType, 3>>, 6u> |
Computes intersection points between 3 edges (as line segments) of triangle A1B1C1 and triangle A2B2C2, and intersection points between 3 edges (as line segments) of triangle A2B2C2 and triangle A1B1C1, in 3D.
TMatrixA1 | Matrix type of the vertex A1 of triangle 1 |
TMatrixB1 | Matrix type of the vertex B1 of triangle 1 |
TMatrixC1 | Matrix type of the vertex C1 of triangle 1 |
TMatrixA2 | Matrix type of the vertex A2 of triangle 2 |
TMatrixB2 | Matrix type of the vertex B2 of triangle 2 |
TMatrixC2 | Matrix type of the vertex C2 of triangle 2 |
A1 | Vertex A of triangle 1 |
B1 | Vertex B of triangle 1 |
C1 | Vertex C of triangle 1 |
A2 | Vertex A of triangle 2 |
B2 | Vertex B of triangle 2 |
C2 | Vertex C of triangle 2 |