Skip to content

height_field: the height field with its casts, query and mover - #7

Merged
nicolas-maman merged 1 commit into
mainfrom
feat/height-field
Sep 20, 2026
Merged

nicolas-maman merged 1 commit into
mainfrom
feat/height-field

Conversation

@nicolas-maman

Copy link
Copy Markdown
Contributor

The ninth layer: Box3D's height_field.c as aephysics.height_field.

  • Heights quantised to a global range (16-bit quanta held as ints), a material per cell with HEIGHT_FIELD_HOLE, edge flags per triangle against the diagonal and the four neighbours, either winding (get_height_field_triangle swaps the edge bits with the vertices).
  • Overlap, ray cast and shape cast by the DDA walk of the swept box's leading corner through the cells (the walk's fractions mapped back to the input sweep before the exit test), the mover's planes, the box query.
  • test_height_field.ae: the reference's subtests minus the file roundtrip, with the shape and ray casts checked against a brute force over every triangle of a wave (600 + 200 casts), plus the flags of a ridge and of holes, a scaled field, the query and the mover. 113 checks.
  • bench/height_field.ae vs bench/height_field_box3d.c (512 x 512 wave with holes): identical hits and sums; query at parity, rays 1.4x, build 1.5x, shape casts 2.1x. Recorded in bench/RESULTS.md.

aephysics.height_field, Box3D's height_field.c in Aether: heights
quantised to a global range so neighbouring fields line up, a material
per cell with holes, the edge flags of every triangle against its four
neighbours, either winding; the overlap, the ray and shape casts by a
DDA walk of the swept box's leading corner through the cells, the
character mover's planes and the box query.

test_height_field.ae: the reference's create, index mapping on an
asymmetric grid, winding normals, flat-field ray, overlap at the
surface, the vertical casts straddling a cell boundary, the shape and
ray casts against a brute force over every triangle of a wave, and the
back side culled for both windings (the file roundtrip is not ported);
plus the flags of a ridge and of holes, a scaled field, the box query,
the mover. 113 checks.

bench/height_field.ae against bench/height_field_box3d.c on a 512 x 512
wave with holes: the same hits and sums on every phase; the box query at
parity, the ray walk 1.4x, the build 1.5x, the shape cast 2.1x.
@nicolas-maman
nicolas-maman merged commit 261a152 into main Sep 20, 2026
1 check passed
@nicolas-maman
nicolas-maman deleted the feat/height-field branch September 20, 2026 00:19
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