benilla-re systems structs docs

IntersectUnitRayTriangle

function · gxumath · unreached

Address
0x5c5560 · 574 bytes, up to 0x5c579d
Signature
uint32_t __fastcall (const float *origin, const float *dir, const float *v0, const float *v1, const float *v2, float *t)
Meaning
Tests a unit ray against a triangle by Moller-Trumbore and stores the distance on a hit
Confidence
verified, proof one
Finding
gxumath#ray-and-triangle

Finding: Ray and triangle in gxumath

0x5c5560 (ecx origin, edx direction; v0, v1, v2 and the output on the stack; ret 0x10) stores +∞ to the output and applies the same direction test. With e1 = v1 − v0, e2 = v2 − v0, p = d × e2, det = e1·p: it misses for |det| < 2⁻²², and with iv = RN24(1/det), u = ((o − v0)·p)·iv and q = (o − v0) × e1, v = (d·q)·iv, it hits for 0 ≤ u ≤ 1, 0 ≤ v and u + v ≤ 1, storing t = (e2·q)·iv. NaN passes every miss test. t may be negative.

The derivation is in the doc.

Callers 2

Callees 3

Calls and jumps by a bare address, from tables/calls.tsv.