Skip to content

aephysics.triangle_manifold: one mesh triangle against sphere, capsule, hull - #5

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

nicolas-maman merged 1 commit into
mainfrom
feat/triangle-manifold

Conversation

@nicolas-maman

Copy link
Copy Markdown
Contributor

The seventh layer: Box3D's triangle_manifold.c in Aether, as aephysics.triangle_manifold — what a mesh or height field will collide through.

  • Back-side cull with hysteresis; closest_point_on_triangle by Voronoi region with the feature; GJK shallow for sphere/capsule; the SAT deep (triangle face, hull faces, arc-crossing edge pairs, the triangle's edges as zero-area faces with a side normal); the SAT cache tried first; a hull face refused as reference when it opposes the triangle (ghost collisions); the edge contact when the face finds nothing or is clearly worse; GJK as the last resort. The triangle feature is recorded on the manifold for the mesh contact's reduction.
  • test_triangle_manifold.ae: 1,540 checks — the triangle parts of the reference's test_manifold.c (tipped cube on a tilted triangle edge into deep overlap, the edge axis carrying the cull, parallel pair through the threshold, the edge sweep against the cross product, capsule across an edge and straddling the face) plus the sphere on every feature, a resting cube, the back-side hysteresis and the cache.
  • bench/triangle.ae vs bench/triangle_box3d.c: identical manifolds (point counts, cache hits, separation sums). Triangle–hull within 10% cold and warm; capsule 1.35×; the sphere case twice as fast.

One aetherc quirk worked around (a module constant inside a struct literal in a return is not resolved); the constants are restated locally with a note.

…e, hull

Box3D's triangle_manifold.c in Aether: the back side culled with
hysteresis, the closest point on a triangle by region with its feature,
GJK for the shallow sphere and capsule cases, the separating axis test
for the deep ones -- the triangle's face, the hull's faces, the edge
pairs whose arcs cross, the triangle's edges as zero-area faces with a
side normal so the axis with a capsule points out of the triangle --
the SAT cache tried first (a face reused only when not deep, an edge
only when its separation held), the hull face refused as reference when
it opposes the triangle, the edge contact when the face has nothing or
one point and the edge is clearly better, and GJK last so nothing
tunnels. The feature the contact came from is recorded for the mesh
contact's ghost-collision reduction.

test_triangle_manifold.ae: 1,540 checks from the triangle parts of
test_manifold.c (the tipped cube's edge on a tilted triangle edge from
speculative gap into deep overlap, the edge axis carrying the cull, the
parallel pair through the rejection threshold, the edge sweep against
the cross product, the capsule pushed across an edge and straddling the
face) plus the sphere on every feature, the resting cube, the back-side
hysteresis and the cache.

bench/triangle.ae against bench/triangle_box3d.c: the same manifolds
(point counts, cache hits and separation sums equal); triangle-hull
within 10% cold and warm, the capsule 1.35x, the sphere twice as fast.
@nicolas-maman
nicolas-maman merged commit 57b91b1 into main Sep 19, 2026
1 check passed
@nicolas-maman
nicolas-maman deleted the feat/triangle-manifold branch September 19, 2026 21:40
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