Expand description
Convex collision queries via the separating axis theorem.
§What this answers, and what it deliberately does not
Two convex shapes are disjoint if and only if some axis exists on which their projections do not overlap. This crate finds such an axis, or proves none exists.
When the shapes are apart it also reports how far apart, because that
is the question a rule check asks: not “do these collide” but “is there
enough clearance”. The axiolid-inspect crate’s mesh clearance answers
the same
question for triangle soups; this answers it for convex shapes without
building an index.
It does not report penetration depth. That is a deliberate refusal,
consistent with axiolid-measure: a contact area and an interpenetration
depth are different measurements, and collapsing them behind one number
is how a caller ends up using the wrong one. Callers needing penetration
depth for physics want EPA, which belongs in a physics engine rather than
a certified geometry kernel.
§Why SAT rather than GJK
For the shapes a model-checking rule actually has – boxes, extruded profiles, hulls with tens of vertices – SAT is direct, has no iteration count to tune, and its failure mode is a clean answer rather than a tolerance-dependent one. GJK wins on high vertex counts and on a generic support function; neither is the common case here, and published commercial model-checking geometry APIs ship convex hull and SAT-style tests without GJK/EPA at all.
§Robustness
Projections are compared with an explicit tolerance rather than exactly. An axis derived from a cross product of two nearly parallel edges is numerically meaningless, so such axes are skipped instead of being allowed to report a spurious separation of ~1e-17.
Structs§
- Contact
- The axis along which two shapes are furthest apart.
- Convex
Shape - A convex shape as its vertices and face normals.
Enums§
- Separation
Result - Outcome of a separating-axis query.
Functions§
- boxes_
intersect - Whether two oriented boxes overlap.
- contains_
point - Whether a point lies inside or on a convex shape.
- distance
- Shortest distance between two convex shapes, or zero if they overlap.
- intersects
- Whether two convex shapes share any point.
- separation
- Find a separating axis between two convex shapes, or prove none exists.