Implementation of the Gilbert-Johnson-Keerthi Algorithm.
#include <GJK.h>
Public Member Functions | |
Constructor | |
GJK () | |
Query functions | |
real_t | doGJK (GeomPrimitive &geom1, GeomPrimitive &geom2, Vec3 &normal, Vec3 &contactPoint) |
Calculate an upper bound for the distance of two Geometries. More... | |
bool | doGJKmargin (GeomPrimitive &geom1, GeomPrimitive &geom2, const real_t margin=contactThreshold) |
Compute if two geometries intersect. More... | |
Get functions | |
const std::vector< Vec3 > & | getSimplex () const |
size_t | getSimplexSize () const |
const std::vector< Vec3 > & | getSupportA () const |
const std::vector< Vec3 > & | getSupportB () const |
Private Member Functions | |
Utility functions | |
bool | simplex2 (Vec3 &d) |
Process a simplex with two nodes. More... | |
bool | simplex3 (Vec3 &d) |
Process a simplex with three nodes. More... | |
bool | simplex4 (Vec3 &d) |
Process a simplex with four nodes. More... | |
bool | sameDirection (const Vec3 &vec1, const Vec3 &vec2) const |
Checks if two vectors roughly point in the same directionTODO. More... | |
bool | zeroLengthVector (const Vec3 &vec) const |
real_t | calcDistance (Vec3 &normal, Vec3 &contactPoint) |
Calculate closest Point in the simplex and its distance to the origin. More... | |
const Vec3 | putSupport (const GeomPrimitive &geom1, const GeomPrimitive &geom2, const Vec3 &dir, const real_t margin, std::vector< Vec3 > &simplex, std::vector< Vec3 > &supportA, std::vector< Vec3 > &supportB, size_t index) |
Calculate a support point of a body extended by a threshold. More... | |
Private Attributes | |
Member variables | |
std::vector< Vec3 > | simplex_ |
std::vector< Vec3 > | supportA_ |
std::vector< Vec3 > | supportB_ |
unsigned char | numPoints_ |
Vec3 | d_ |
|
inlineexplicit |
Calculate closest Point in the simplex and its distance to the origin.
real_t walberla::pe::fcd::GJK::doGJK | ( | GeomPrimitive & | geom1, |
GeomPrimitive & | geom2, | ||
Vec3 & | normal, | ||
Vec3 & | contactPoint | ||
) |
Calculate an upper bound for the distance of two Geometries.
bool walberla::pe::fcd::GJK::doGJKmargin | ( | GeomPrimitive & | geom1, |
GeomPrimitive & | geom2, | ||
const real_t | margin = contactThreshold |
||
) |
Compute if two geometries intersect.
Both can be enlarged by a specified margin.
geom1 | The first Body |
geom2 | The second Body |
margin | The margin by which the objects will be enlarged. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprivate |
Calculate a support point of a body extended by a threshold.
geom1 | The body A. |
geom2 | The body B. |
dir | The support point direction. |
margin | Extension of the Body. |
|
inlineprivate |
Checks if two vectors roughly point in the same directionTODO.
|
private |
Process a simplex with two nodes.
|
private |
Process a simplex with three nodes.
|
private |
Process a simplex with four nodes.
|
inlineprivate |
|
private |
|
private |
|
private |
|
private |
|
private |