Expand description
Collision detection primitives: GJK/EPA narrowphase, SAT, sphere/capsule tests, BVH broadphase, and contact manifold generation.
All geometry is represented with [f64; 3] arrays to avoid nalgebra
dependencies inside this module.
Structs§
- AabbRaw
- Axis-aligned bounding box, stored as
(min, max). - Box3
- An axis-aligned box centred at
centerwithhalf_extents. - Bvh
- A simple axis-aligned BVH built with a median-split strategy.
- BvhLeaf
- A leaf entry in the BVH.
- Capsule
- A capsule: the Minkowski sum of a line segment and a sphere.
- Contact
- A collision contact point.
- Contact
Manifold - A contact manifold: up to 4 persistent contact points between two bodies.
- Convex
Point Cloud - A convex shape defined by a set of points.
- EpaResult
- Result of an EPA penetration-depth query.
- GjkResult
- Result of a GJK query.
- Obb
- An oriented bounding box.
- RayAabb
Hit - Result of a ray–AABB intersection test.
- Sphere
- A sphere centred at
centerwithradius. - Sphere
Sphere Contact - Result of a sphere–sphere intersection test.
- Triangle
- A triangle as a convex shape (degenerate 2-D polyhedron).
Traits§
- Convex
Shape - Trait for convex shapes defined by a support function.
Functions§
- epa
- Run EPA to compute the penetration depth between two overlapping convex shapes.
- gjk
- Run the GJK algorithm to determine if two convex shapes intersect and, if not, compute their minimum distance.
- minkowski_
sum_ support - Support function of the Minkowski sum of two shapes.
- obb_
obb_ sat - Test two OBBs using the Separating Axis Theorem.
Returns
Noneif separated, orSome(depth, axis)with penetration info. - point_
segment_ closest - Signed distance from point
pto the line segment (a→b), and the closest point on the segment. - ray_
aabb - Intersect a ray
(origin, dir)with an AABB. - ray_
sphere - Intersect a ray with a sphere. Returns parameter
tat first hit orNone. - shape_
cast_ sphere_ vs_ aabb - Cast a sphere along
velocityagainst an AABB. Returnst ∈ [0, max_t]orNone. - shape_
cast_ sphere_ vs_ sphere - Cast a moving sphere along
velocitydirection (magnitude = max travel distance) against a static sphere. Returns the first time of contactt ∈ [0, max_t]orNoneif no contact. - sphere_
capsule - Test a sphere and capsule for intersection.
Returns
(overlapping, depth, normal, point). - sphere_
sphere - Test two spheres for intersection and compute the contact manifold.