21 lines
780 B
C
21 lines
780 B
C
#ifndef GJK_H
|
|
#define GJK_H
|
|
|
|
struct gjk_extended_result {
|
|
b32 colliding;
|
|
struct v2 p0, p1; /* Closest points (or penetrating points if colliding) on each shape */
|
|
};
|
|
|
|
/* Returns simple true or false indicating shape collision */
|
|
b32 gjk_boolean(struct v2_array shape0, struct v2_array shape1);
|
|
|
|
/* Returns shape whether shapes are colliding well as closest / penetrating points on each shape.
|
|
*
|
|
* If shapes are colliding and `penetration_dir` is non-zero, the shortest
|
|
* direction to resolve the collision will be used to calculate penetrating
|
|
* points. Otherwise, the penetrating points will be calculated using the
|
|
* supplied direction. */
|
|
struct gjk_extended_result gjk_extended(struct v2_array shape0, struct v2_array shape1, struct v2 penetration_dir);
|
|
|
|
#endif
|