Skip to content

cf_gjk3

Category: collision
GitHub: cute_math3d.h


Returns the distance between two 3d shapes, and their closest points.

float cf_gjk3(const void* A, CF_ShapeType3 typeA, const void* B, CF_ShapeType3 typeB, CF_V3* outA, CF_V3* outB, bool use_radius, int* iterations, CF_GjkCache3* cache);
Parameters Description
A The first shape.
typeA The CF_ShapeType3 of the first shape A.
B The second shape.
typeB The CF_ShapeType3 of the second shape B.
outA The closest point on A to B. Not well defined when intersecting. May be NULL.
outB The closest point on B to A. Not well defined when intersecting. May be NULL.
use_radius True to use the radius of any CF_Sphere/CF_Capsule3 inputs, false to treat them as a point/segment.
iterations Can be NULL. The number of internal GJK iterations, for debugging.
cache Can be NULL. An optional warm-start cache, see CF_GjkCache3.

Return Value

Returns the distance between the two shapes; zero when overlapped.

CF_GjkCache3
CF_ShapeType3
cf_toi3
cf_gjk