Skip to content

aephysics.distance: GJK, the shape cast, the time of impact - #3

Merged
nicolas-maman merged 1 commit into
mainfrom
feat/distance
Sep 19, 2026
Merged

nicolas-maman merged 1 commit into
mainfrom
feat/distance

Conversation

@nicolas-maman

Copy link
Copy Markdown
Contributor

The fifth layer: Box3D's distance.c in Aether, as aephysics.distance.

  • GJK: the simplex solved by Voronoi regions with barycentric coordinates, warm-started from a cache whose metric is checked, the duplicate support as the termination. The shape cast by conservative advancement. The time of impact by a separation function (vertices, edges, or a face of either shape) from the cached simplex, root-found with false position and bisection in turn.
  • CastOutput moves here from the hull; the hull gains overlap_hull, shape_cast_hull and hull_proxy through this layer (the three functions deferred in aephysics.hull: quickhull and the half-edge hull #2).
  • test_distance.ae: the reference's four checks plus 1,139 more — spheres/capsules against boxes at analytic distances, overlap, warm vs cold cache over 200 poses, witnesses inside their shapes and as far apart as the distance, no axis separating more than the distance, a rotating box falling on a slab (hit / miss / overlapped), the hull's queries.
  • bench/distance.ae vs bench/distance_box3d.c: identical results (sums equal to the reference's float precision, GJK iterations within 0.01%) at 1.3–1.5× its time.

Differences: the simplex's four vertices are named fields (passed by value, never allocated) and the cache's index pairs are named ints.

Box3D's distance.c in Aether: the simplex solved by Voronoi regions with
barycentric coordinates, the support search warm-started from a cache
whose metric is checked, the duplicate support as the termination; the
shape cast by conservative advancement on the distance; the time of
impact that builds a separation function (vertices, edges, a face of
either) from the cached simplex and root-finds on it with false
position and bisection in turn. The simplex's vertices are named
fields, the cache's index pairs named ints; CastOutput moves here from
the hull, which now has overlap_hull, shape_cast_hull and hull_proxy
through it.

test_distance.ae: the reference's four checks and 1,139 more -- spheres
and capsules against boxes at analytic distances, overlap, the warm
cache agreeing with a cold one over 200 poses, witness points inside
their shapes and as far apart as the distance, no axis separating more
than it, a rotating box falling on a slab in the time of impact (hit,
miss, overlapped), and the hull's queries.

bench/distance.ae against bench/distance_box3d.c: the same results
(distance, cast and impact sums equal to the reference's float
precision, GJK iterations within 0.01%) at 1.3-1.5x its time.
@nicolas-maman
nicolas-maman merged commit dac04bc into main Sep 19, 2026
1 check passed
@nicolas-maman
nicolas-maman deleted the feat/distance branch September 19, 2026 20:25
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