Jolt Physics
A multi core friendly Game Physics Engine
|
#include <GJKClosestPoint.h>
Convex vs convex collision detection Based on: A Fast and Robust GJK Implementation for Collision Detection of Convex Objects - Gino van den Bergen
|
inline |
Test if a ray inRayOrigin + lambda * inRayDirection for lambda e [0, ioLambda> intersects inA
Code based upon: Ray Casting against General Convex Objects with Application to Continuous Collision Detection - Gino van den Bergen
inRayOrigin | Origin of the ray |
inRayDirection | Direction of the ray (ioLambda * inDirection determines length) |
inTolerance | The minimal distance between the ray and A before it is considered colliding |
inA | A convex object that has the GetSupport(Vec3) function |
ioLambda | The max fraction along the ray, on output updated with the actual collision fraction. |
|
inline |
Test if a cast shape inA moving from inStart to lambda * inStart.GetTranslation() + inDirection where lambda e [0, ioLambda> intersects inB
inStart | Start position and orientation of the convex object |
inDirection | Direction of the sweep (ioLambda * inDirection determines length) |
inTolerance | The minimal distance between A and B before they are considered colliding |
inA | The convex object A, must support the GetSupport(Vec3) function. |
inB | The convex object B, must support the GetSupport(Vec3) function. |
ioLambda | The max fraction along the sweep, on output updated with the actual collision fraction. |
|
inline |
Test if a cast shape inA moving from inStart to lambda * inStart.GetTranslation() + inDirection where lambda e [0, ioLambda> intersects inB
inStart | Start position and orientation of the convex object |
inDirection | Direction of the sweep (ioLambda * inDirection determines length) |
inTolerance | The minimal distance between A and B before they are considered colliding |
inA | The convex object A, must support the GetSupport(Vec3) function. |
inB | The convex object B, must support the GetSupport(Vec3) function. |
inConvexRadiusA | The convex radius of A, this will be added on all sides to pad A. |
inConvexRadiusB | The convex radius of B, this will be added on all sides to pad B. |
ioLambda | The max fraction along the sweep, on output updated with the actual collision fraction. |
outPointA | is the contact point on A (if outSeparatingAxis is near zero, this may not be not the deepest point) |
outPointB | is the contact point on B (if outSeparatingAxis is near zero, this may not be not the deepest point) |
outSeparatingAxis | On return this will contain a vector that points from A to B along the smallest distance of separation. The length of this vector indicates the separation of A and B without their convex radius. If it is near zero, the direction may not be accurate as the bodies may overlap when lambda = 0. |
|
inline |
Get closest points between inA and inB
inA | The convex object A, must support the GetSupport(Vec3) function. |
inB | The convex object B, must support the GetSupport(Vec3) function. |
inTolerance | The minimal distance between A and B before the objects are considered colliding and processing is terminated. |
inMaxDistSq | The maximum squared distance between A and B before the objects are considered infinitely far away and processing is terminated. |
ioV | Initial guess for the separating axis. Start with any non-zero vector if you don't know. If return value is 0, ioV = (0, 0, 0). If the return value is bigger than 0 but smaller than FLT_MAX, ioV will be the separating axis in the direction from A to B and its length the squared distance between A and B. If the return value is FLT_MAX, ioV will be the separating axis in the direction from A to B and the magnitude of the vector is meaningless. |
outPointA,outPointB | If the return value is 0 the points are invalid. If the return value is bigger than 0 but smaller than FLT_MAX these will contain the closest point on A and B. If the return value is FLT_MAX the points are invalid. |
|
inline |
Get the resulting simplex after the GetClosestPoints algorithm finishes. If it returned a squared distance of 0, the origin will be contained in the simplex.
|
inline |
Test if inA and inB intersect
inA | The convex object A, must support the GetSupport(Vec3) function. |
inB | The convex object B, must support the GetSupport(Vec3) function. |
inTolerance | Minimal distance between objects when the objects are considered to be colliding |
ioV | is used as initial separating axis (provide a zero vector if you don't know yet) |