ReactPhysics3D
v0.10.2
C++ Physics engine library
|
This class represents a simplex which is a set of 3D points. More...
#include <include/reactphysics3d/collision/narrowphase/GJK/VoronoiSimplex.h>
Public Member Functions | |
VoronoiSimplex () | |
Constructor. | |
~VoronoiSimplex () | |
Destructor. | |
bool | isFull () const |
Return true if the simplex contains 4 points. | |
bool | isEmpty () const |
Return true if the simplex is empty. | |
int | getSimplex (Vector3 *mSuppPointsA, Vector3 *mSuppPointsB, Vector3 *mPoints) const |
Return the points of the simplex. | |
decimal | getMaxLengthSquareOfAPoint () const |
Return the maximum squared length of a point. | |
void | addPoint (const Vector3 &point, const Vector3 &suppPointA, const Vector3 &suppPointB) |
Add a new support point of (A-B) into the simplex. | |
void | removePoint (int index) |
Remove a point from the simplex. | |
void | reduceSimplex (int bitsUsedPoints) |
Reduce the simplex (only keep vertices that participate to the point closest to the origin) | |
bool | isPointInSimplex (const Vector3 &point) const |
Return true if the point is in the simplex. | |
bool | isAffinelyDependent () const |
Return true if the set is affinely dependent. | |
void | backupClosestPointInSimplex (Vector3 &point) |
Backup the closest point. | |
void | computeClosestPointsOfAandB (Vector3 &pA, Vector3 &pB) const |
Compute the closest points "pA" and "pB" of object A and B. | |
bool | computeClosestPoint (Vector3 &v) |
Compute the closest point to the origin of the current simplex. | |
This class represents a simplex which is a set of 3D points.
This class is used in the GJK algorithm. This implementation is based in the book "Real-Time Collision Detection" by Christer Ericson. This simple is used to replace theJohnson's algorithm for computing the point of a simplex that is closest to the origin and also the smallest simplex needed to represent that closest point.
void VoronoiSimplex::addPoint | ( | const Vector3 & | point, |
const Vector3 & | suppPointA, | ||
const Vector3 & | suppPointB | ||
) |
Add a new support point of (A-B) into the simplex.
suppPointA : support point of object A in a direction -v suppPointB : support point of object B in a direction v point : support point of object (A-B) => point = suppPointA - suppPointB
Compute the closest points "pA" and "pB" of object A and B.
The points are computed as follows : pA = sum(lambda_i * a_i) where "a_i" are the support points of object A pB = sum(lambda_i * b_i) where "b_i" are the support points of object B with lambda_i = deltaX_i / deltaX.
bool VoronoiSimplex::isAffinelyDependent | ( | ) | const |
Return true if the set is affinely dependent.
A set if affinely dependent if a point of the set is an affine combination of other points in the set.
void VoronoiSimplex::reduceSimplex | ( | int | bitsUsedPoints | ) |
Reduce the simplex (only keep vertices that participate to the point closest to the origin)
bitsUsedPoints is seen as a sequence of bits representing whether the four points of the simplex are used or not to represent the current closest point to the origin.