IntersectUnitRaySphere
function · gxumath · unreached
- Address
0x5c53e0· 265 bytes, up to0x5c54e8- Signature
uint32_t __fastcall (const float *origin, const float *dir, const float *center, float radius, float *t)- Meaning
- Tests a unit ray against a sphere and stores the distance along it to the closest approach on a hit
- Confidence
- verified, proof one
- Finding
- gxumath#ray-and-sphere
Finding: Ray and sphere in gxumath
0x5c53e0 (ecx origin, edx direction; centre, radius and the output on the stack; ret 0xc)
stores the float +∞ at 0xc2b850 to the output, and requires |dir·dir − 1| < 2⁻¹⁰, else error 0x57
and 0. With t = (c − o)·d it returns 1 and stores t when t ≥ −radius and the distance² from
o + t·d to c is at most radius²; otherwise 0. t is the distance to the closest approach, not
an entry point, and may be negative. A NaN in the origin or centre passes the first test and fails
the second.
The derivation is in the doc.
Callers 0
None by a direct call or jump.
Callees 1
- SErrSetLastError storm
Calls and jumps by a bare address, from tables/calls.tsv.