Documentation / @ripl/3d / rayIntersectTriangle
Function: rayIntersectTriangle() ​
rayIntersectTriangle(
ray,a,b,c):RayTriangleHit|null
Defined in: 3d/src/math/ray.ts:63
Intersects a ray with a triangle using the Möller–Trumbore algorithm.
Both facings are reported rather than culled, because a Shape3D's faces carry whatever winding their author emitted and rejecting on it would silently miss geometry. Callers that want front-facing hits only can filter on RayTriangleHit.backFacing.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
ray | Ray | The ray to cast. |
a | Vector3 | The triangle's first vertex. |
b | Vector3 | The triangle's second vertex. |
c | Vector3 | The triangle's third vertex. |
Returns ​
RayTriangleHit | null
The hit, or null when the ray misses, is parallel, or would hit behind its origin.