Flock::Collision::Narrowphase2D
Exact shape-vs-shape tests. Each returns a Manifold2D? (nil when the
shapes do not overlap), with the normal pointing from A toward B.
All shape pairs are supported, with rotation: circle / capsule pairs -> unified as "rounded cores" (point or segment + radius) via closest-segment-segment, so circle-circle, circle-capsule and capsule-capsule share one routine. box (OBB) pairs -> SAT for box-box, closest-point-on-OBB for box-vs-rounded.
box-box produces up to TWO contact points (reference/incident face clipping) so resting boxes stay flat instead of pivoting on one point.
Known v1 limitations (documented, not silent):
- box-capsule produces a single contact point (fine for an upright capsule resting on a box; a capsule lying flat gets one point, not two).
- capsule-box uses an accurate closest-point test when the capsule's core segment is outside the box (the common resting case) and an approximate minimum-translation push when the core actually penetrates the box.
Constants
Instance methods
Axis-aligned box A vs axis-aligned box B (thin wrapper over the OBB test).
Capsule A (core segment a0..a1, radius r) vs box B. Normal points A -> B.
Circle A vs an axis-aligned box B (thin wrapper over the OBB test).
Circle A (center cpos, radius r) vs box B. Normal points A -> B.
Dispatch on the shape pair. A is (ca, ta), B is (cb, tb). Returns a
ContactManifold2D (1 or 2 points); box-box yields two points when the
contact is edge-to-edge.
Box A vs box B via SAT (2D: 4 axes) followed by reference/incident face clipping to produce up to two contact points. Normal points A -> B.