PointSegmentDistanceSquared
function · cmath · primitive
- Address
0x7c46d0· 266 bytes, up to0x7c47d9- Signature
float __fastcall (const NTempest::C3Segment *segment, const NTempest::C3Vector *point, float *outT)- Meaning
- Returns the squared distance from a point to a segment and writes the clamped parameter
- Confidence
- verified, proof two
- Finding
- cmath/geometry#point-to-segment
- Test
cmath::seg_proj_difftest,models::aabsp_nearest_dist_difftest
Finding: Point to segment in cmath: intersections
0x7c46d0(outT) returns, in st0, the squared distance from the point in edx to the segment in ecx
(a at +0, b at +0xc), and writes the clamped parameter to outT when it is non-null. With ab = b − a
and d = (q − a)·ab: t = 0 for d ≤ 0, t = 1 for d above |ab|², else t = d/|ab|²; the squared distance is
|q − (a + t·ab)|². A zero-length segment takes t = 0. The closest point is not written.
The derivation is in the doc.
Callers 1
- MapObjPortalPointDistance models
Callees 1
- SetVector3 spline
Calls and jumps by a bare address, from tables/calls.tsv.