Documentation / @ripl/3d / rayIntersectsBox
Function: rayIntersectsBox() ​
rayIntersectsBox(
ray,bounds):boolean
Defined in: 3d/src/math/ray.ts:186
Tests a ray against an axis-aligned bounding box using the slab method.
A conservative reject: it never misses a box the ray really meets, but an axis the ray runs exactly along the face of may report a hit it does not have. That is the right trade for a broad phase, whose only job is to keep whole meshes out of the triangle loop.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
ray | Ray | The ray to cast. |
bounds | ArrayLike<number> | The box as [minX, minY, minZ, maxX, maxY, maxZ]. |
Returns ​
boolean
Whether the ray may meet the box.