Phase 1 / Forge / Queries: raycast#63
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tenth M1.1 sub-milestone. Everything before it moves bodies; this one interrogates them.
Only the raycast is implemented; the complete query family's signatures freeze here, because
a comptime strategy interface cannot gain a method after its M1.1.15 freeze without breaking
every Tier 3 solver.
What lands
foundation/math/aabb.zig—Aabb(T).rayInterval: the slab test returning theparametric interval. A direction component that is exactly zero leaves the product and is
replaced by origin-in-slab containment — TRUE ZERO, no epsilon, deliberately unlike the
reference's absolute
1.0e-20fguard. Plus an exactNaN -> 0repair for the one0 * infthe mask cannot cover (a subnormal component with the origin on a face plane:the numerator is exactly zero, so the repair is the exact quotient, not a tolerance), and
a domain assertion that makes that exactness a precondition instead of a hope.
pipeline/broadphase.zig—Bvh(T).queryRay+Broadphase(T).queryRay, branch andbound on the existing traversal. The collector contract gains
maxDistance(), re-readbefore every descent, and
shouldStop(), read before every descent, between the fourlayer trees and before each root. The two are not interchangeable: a zero bound still
admits every node whose interval contains the origin and says nothing about trees not yet
walked, so "terminates at the first candidate" needed the second. Descent is near-first.
pipeline/narrowphase/raycast.zig(new) — analytic ray-core kernels in the core +inflation-radius convention. A rounded box fails loud, rejected before the membership test
since a shape rejection cannot depend on where the ray starts. Both quadratics are written
cancellation-free: at f32, a radius-1 sphere 5 000 m away used to return a distance short
by exactly the radius with a normal of length ZERO.
forge_3d/query.zig(new) — statelessReal-bound orchestration taking(bp, bm, store): the shared filter, the three collectors, the exact tie-break on thesmaller
BodyId, and a normalisation that survives both ends of the float range.api/types.zig— the seven public query types, a verbatim mirror ofengine-tier-interfaces.md§1, pluscollision_layer_countand a typederror.InvalidCollisionLayerinaddBody. The five deferred entries keep their frozensignatures and
@panic: they carry no error channel, so anullor a0would be asilent lie in the caller's own vocabulary.
Two corrections outside the milestone's own scope
Body.rotationis now unit at the solver precision, permanently. An f32-unitquaternion widened to f64 is off by
3.4e-8; the invariant held by accident for a dynamicbody from its first tick and never for a static or kinematic one, scaling a static
collider's frame by
1 ± 3.4e-8— 0.34 mm at 10 km, the regime-Dphysics_f64existsfor. Pre-existing, exposed by the raycast's unit-direction assertion, corrected here. The
eleven inherited M1.1.5-M1.1.8 envelope quantities were re-measured against
mainthrougha worktree at both precisions: zero movement, digit for digit.
tests/ipc/crash_recovery.zigasserts behaviour, not latency. Four wall-clockassertions measured kernel scheduling on a machine the suite loads itself; one of them
refused a push. They are gone, every behaviour assertion stays, and the measured figures
live in
validation/s6-go-nogo.md.Verification
-Dphysics_f64=true, debug AND ReleaseSafe.zig build,zig build test(debug + ReleaseSafe),zig fmt --check,zig build lint:all clean.
845 ns/ray, any 558, all-32 1 458, closest with a 5 m bound 392. No envelope is
pre-registered — this is the first measurement of the path.
git diff mainover 4 781 lines, zero French accented characters andzero French function words in added lines, same over the brief. Three quotations were found
and rewritten in English rather than excused.
Open for review
The
CLAUDE.md§3.4 patch content was never received in-session; the applied patch isderived from the milestone and submitted as a draft — see the brief's Closing notes, which
names it as the one place to overwrite wholesale.