Skip to main content

Module ray_aabb

Module ray_aabb 

Source
Expand description

S1.1 — ray ↔ axis-aligned bounding box clip helper.

Standard slab-method intersection. Used by the S1 outside-camera dispatch (opticast.rs) to find the t-parameter at which an outside-the-grid camera ray first enters the world’s column AABB, so gline can be initialised at that face hit instead of at the camera origin (which sits past vsid).

Will also be reused by S5 (per-grid rotation: each grid’s grid-local ray gets clipped against the grid’s local AABB before the cross-chunk DDA starts) and S6 (LOD selection: distance to the AABB is part of the near/mid/far classifier).

Functions§

clip_ray_to_aabb
Intersect a ray origin + t * dir against the axis-aligned box [aabb_min, aabb_max] and return Some((t_enter, t_exit)) if the ray hits the box at any t, else None.
clip_ray_to_xy_aabb
2D slice of clip_ray_to_aabb in the XY plane only — what S1.2 actually needs at the dispatch level. Voxlap’s column grid is indexed by (cx, cy); Z is handled inside each column’s slab data, so the per-frame outside check only cares about whether a ray ever enters the XY footprint of the grid.