Skip to content

Phase 1 / Forge / Forge 3D narrowphase fast paths#57

Merged
guysenpai merged 24 commits into
mainfrom
phase-1/forge/narrowphase-fast-paths
Jul 20, 2026
Merged

Phase 1 / Forge / Forge 3D narrowphase fast paths#57
guysenpai merged 24 commits into
mainfrom
phase-1/forge/narrowphase-fast-paths

Conversation

@guysenpai

Copy link
Copy Markdown
Contributor

M1.1.4 — the four analytic per-pair narrowphase fast paths (fifth M1.1 sub-milestone), dispatched from collideOrdered before GJK: sphere/sphere, sphere/box, capsule/capsule, box/box (radius-0 box only; a rounded box falls through to the generic path).

Architecture

Each kernel computes only a ContactSeed { normal (A→B), core closest points, base_penetration } fed to the unchanged generateManifold — so the feature_id producers, supporting-face clipping, ≤4 reduction, per-point penetration, order-independence and frame-stability are all inherited by construction. The fast path replaces only the GJK descent + EPA polytope expansion.

  • fastSeed — 3-state dispatcher (not_handled / separated / contact); separated mirrors gjk.zig (conv_k=16, coord_scale=|Δpos|+coreExtent).
  • sphere/box deep = closed-form least-penetration face (point/box P1d fix, validated >200:1).
  • box/box = 15-axis SAT (order-independent; separation tested on every non-zero raw edge×edge axis; edge-edge witness via full-degenerate Ericson closestSegSeg) — fixes box/box P1d and bypasses the M1.1.3 deep-rotated EPA frame-dependence for box/box.
  • capsule/capsule = closestSegSeg → 3 regimes via generateManifold (crossed via the E1 generator fix; collinear/parallel radial normal, never axial).
  • E1 generator fix (pre-existing M1.1.3 defect): segment × segment non-parallel → single witness.

Threshold-class discipline (hardened across a 5-round external review, all RED-first in-milestone)

  • Normalization guards fire only at true zero (floatMin, never a geometric scale).
  • Point-set dedup is relative to the candidates' per-axis EXTENT (max−min) — translation + scale + anisotropy invariant.
  • Separation margins are k·floatEps·coordScale.

Defects closed RED-first: degenerate-segment closest points, SAT separating-axis completeness, collinear-capsule normal, and the length-threshold class (fast_paths + the shared manifold.zig generator).

Validation

Differential vs collideOrderedGeneric (gated on oracle self-consistency), closed-form P1d / extreme-aspect, oracle-free deep+rotated box/box (order-independence + inline-SAT MTV + frame-invariance), feature_id producer×pair×order matrix, and a scale×translation×anisotropy×decentre×order invariance matrix. Full suite green at f32 and -Dphysics_f64=true, debug + ReleaseSafe. Bench (ReleaseFast, dispatched/generic): 0.55 ss / 0.27 sb / 0.27 bb / 0.12 cc. No gjk.zig/epa.zig touched.

Tracked (out of scope)

  • Generic EPA deep-rotated frame-dependence (M1.1.3 defect) → hotfix m1.1.3-hf-epa-frame-dependence; residual exposure: capsule/box + sphere/capsule stay on the generic path.
  • Contact-point position accuracy far from body A's centre is f32-limited (a generateManifold precision characteristic).

🤖 Generated with Claude Code

@guysenpai
guysenpai merged commit a299579 into main Jul 20, 2026
10 checks passed
@guysenpai
guysenpai deleted the phase-1/forge/narrowphase-fast-paths branch July 20, 2026 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant