benilla-re systems structs docs

PolygonContactDistance

function · collision · primitive

Address
0x632830 · 321 bytes, up to 0x632970
Signature
uint32_t __fastcall (void *polygon, const float *dir, const float *planes, uint32_t face, float *best)
Meaning
Measures the travel until a volume face reaches a polygon: 0 when touching, none past 1/36 behind
Confidence
verified, proof one
Finding
collision/contact#contact-distance
Test
collision::toi_difftest

Finding: Contact distance in collision: contact

0x6329e0(q, plane, dir) returns (n·q + d)/(n·dir) at 53 bits, or n·q + d undivided when abs(n·dir) is below 2^−22 (0x34800000); a NaN n·dir divides. For a volume face and a unit dir it is the travel after which the face reaches q, negative behind it. 0x632830(poly, dir, planes, k, best) measures each vertex of the polygon against plane k:

stepeffect
1m = *best; at each t below m, m = t when t > 0, else 0; a NaN t is skipped
2some t above −2^−20 (0xb5800000, 0x80dff4): go to step 4
3clip by the other eight planes; nothing left, or every remaining t at or below −1/36 (0xbce38e39) or NaN: return 0
4m below *best, or *best NaN: *best = m, return 1; else return 0

The derivation is in the doc.

Callers 1

Callees 2

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