The Expanding-Polytope Algorithm.
#include <EPA.h>
Classes | |
class | EPA_Edge |
Class storing Information about an Edge of the EPA-Polytope. More... | |
class | EPA_Triangle |
Class storing Information about a triangular facette (Triangle) of the EPA-Polytope. More... | |
class | EPA_TriangleComp |
Compare Triangles by their closest points to sort the triangle heap. More... | |
Public Member Functions | |
Query functions | |
bool | doEPAcontactThreshold (Support &geom1, Support &geom2, const GJK &gjk, Vec3 &normal, Vec3 &contactPoint, real_t &penetrationDepth) |
Does an EPA computation with contactthreshold added. More... | |
bool | doEPAcontactThreshold (Support &geom1, Support &geom2, const GJK &gjk, Vec3 &normal, Vec3 &contactPoint, real_t &penetrationDepth, real_t eps_rel) |
Does an EPA computation with contactThreshold added. More... | |
bool | doEPAmargin (Support &geom1, Support &geom2, const GJK &gjk, Vec3 &normal, Vec3 &contactPoint, real_t &penetrationDepth, real_t margin) |
Does an EPA computation with margin added. More... | |
bool | doEPA (Support &geom1, Support &geom2, const GJK &gjk, Vec3 &normal, Vec3 &contactPoint, real_t &penetrationDepth, real_t margin, real_t eps_rel) |
Does an epa computation with contact margin added and specified relative error. More... | |
Getter and Setter functions | |
void | setMaxSupportPoints (size_t maxSupportPoints) |
size_t | getMaxSupportPoints () |
void | setMaxTriangles (size_t maxTriangles) |
size_t | getMaxTriangles () |
int | getNumIterations () const |
bool | useSphereOptimization () const |
void | useSphereOptimization (const bool useIt) |
Static Public Attributes | |
static constexpr real_t | contactThreshold = real_t(1e-8) |
Private Types | |
using | EPA_EntryBuffer = std::vector< EPA_Triangle > |
using | EPA_EntryHeap = std::vector< EPA_Triangle * > |
using | EPA_EdgeBuffer = std::vector< EPA_Edge > |
Utility functions | |
size_t | maxSupportPoints_ = 100 |
size_t | maxTriangles_ = 200 |
int | numIterations_ = 0 |
bool | bUseSphereOptimization_ = false |
void | pushSupportMargin (const Support &geom1, const Support &geom2, const Vec3 &dir, const real_t margin, std::vector< Vec3 > &epaVolume, std::vector< Vec3 > &supportA, std::vector< Vec3 > &supportB) |
Calculates a support point of a body extended by threshold. More... | |
void | replaceSupportMargin (const Support &geom1, const Support &geom2, const Vec3 &dir, const real_t margin, std::vector< Vec3 > &epaVolume, std::vector< Vec3 > &supportA, std::vector< Vec3 > &supportB, size_t indexToReplace) |
Calculates a support point of a body extended by threshold. More... | |
void | removeSupportMargin (std::vector< Vec3 > &epaVolume, std::vector< Vec3 > &supportA, std::vector< Vec3 > &supportB) |
Removes a support point from the volume. More... | |
bool | originInTetrahedron (const Vec3 &A, const Vec3 &B, const Vec3 &C, const Vec3 &D) |
TODO. More... | |
bool | originInTetrahedronVolumeMethod (const Vec3 &A, const Vec3 &B, const Vec3 &C, const Vec3 &D) |
Returns true, if the origin lies in the tetrahedron ABCD. More... | |
bool | pointInTetrahedron (const Vec3 &A, const Vec3 &B, const Vec3 &C, const Vec3 &D, const Vec3 &point) |
Returns true, if a point lies in the tetrahedron ABCD. More... | |
bool | searchTetrahedron (Support &geom1, Support &geom2, std::vector< Vec3 > &epaVolume, std::vector< Vec3 > &supportA, std::vector< Vec3 > &supportB, EPA_EntryBuffer &entryBuffer, real_t margin) |
Search a tetrahedron that contains the origin. More... | |
void | createInitialTetrahedron (size_t top, size_t frontLeft, size_t frontRight, size_t back, std::vector< Vec3 > &epaVolume, EPA_EntryBuffer &entryBuffer) |
TODO top, frontLeft ... More... | |
void | createInitialSimplex (size_t numPoints, Support &geom1, Support &geom2, std::vector< Vec3 > &supportA, std::vector< Vec3 > &supportB, std::vector< Vec3 > &epaVolume, EPA_EntryBuffer &entryBuffer, real_t margin) |
Create a starting tetrahedron for EPA, from the GJK Simplex. More... | |
real_t | calculateCircle (const Vec3 &A, const Vec3 &B, const Vec3 &C, const Vec3 &D, Vec3 ¢er) |
Calculate a Circle through the for Points A, B, C, D. More... | |
|
private |
|
private |
|
private |
|
inlineprivate |
Calculate a Circle through the for Points A, B, C, D.
center | Contains the center point of the circle after the call |
|
inlineprivate |
TODO top, frontLeft ...
are indices
bool walberla::mesa_pd::collision_detection::EPA::doEPA | ( | Support & | geom1, |
Support & | geom2, | ||
const GJK & | gjk, | ||
Vec3 & | normal, | ||
Vec3 & | contactPoint, | ||
real_t & | penetrationDepth, | ||
real_t | margin, | ||
real_t | eps_rel | ||
) |
Does an epa computation with contact margin added and specified relative error.
bool walberla::mesa_pd::collision_detection::EPA::doEPAcontactThreshold | ( | Support & | geom1, |
Support & | geom2, | ||
const GJK & | gjk, | ||
Vec3 & | retNormal, | ||
Vec3 & | contactPoint, | ||
real_t & | penetrationDepth | ||
) |
Does an EPA computation with contactthreshold added.
Use Default relative Error.
bool walberla::mesa_pd::collision_detection::EPA::doEPAcontactThreshold | ( | Support & | geom1, |
Support & | geom2, | ||
const GJK & | gjk, | ||
Vec3 & | retNormal, | ||
Vec3 & | contactPoint, | ||
real_t & | penetrationDepth, | ||
real_t | eps_rel | ||
) |
Does an EPA computation with contactThreshold added.
Relative Error can be specified.
bool walberla::mesa_pd::collision_detection::EPA::doEPAmargin | ( | Support & | geom1, |
Support & | geom2, | ||
const GJK & | gjk, | ||
Vec3 & | retNormal, | ||
Vec3 & | contactPoint, | ||
real_t & | penetrationDepth, | ||
real_t | margin | ||
) |
Does an EPA computation with margin added.
Use Default relative Error.
|
inline |
|
inline |
|
inline |
|
inlineprivate |
TODO.
see Book "collision detection in interactive 3D environments" page161 ATTENTION seems to have no consistent behavior on the surface and vertices
|
inlineprivate |
Returns true, if the origin lies in the tetrahedron ABCD.
|
inlineprivate |
Returns true, if a point lies in the tetrahedron ABCD.
point | The point to be checked for containment. |
|
inlineprivate |
Calculates a support point of a body extended by threshold.
Adds this support and the base points at bodies A and B to the vector.
geom1 | The body A. |
geom2 | The body B. |
dir | The support point direction. |
margin | Extension of the Body. |
|
inlineprivate |
Removes a support point from the volume.
|
inlineprivate |
Calculates a support point of a body extended by threshold.
Replaces the old value in the vectors at "IndexToReplace" with this support and the base points at bodies A and B.
geom1 | The body A. |
geom2 | The body B. |
dir | The support point direction. |
margin | Extension of the Body. |
|
inlineprivate |
Search a tetrahedron that contains the origin.
Start with four arbitrary support points in epaVolume that form a tetrahedron. (This needn't contain the origin.) This algorithm will search and return an altered tetrahedron containing the origin. Do only use this function if the object/body certainly contains the origin!
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
staticconstexpr |
|
private |
|
private |
|
private |