benilla-re systems structs docs

ClipPolygonByPlane

function · collision · primitive

Address
0x6318c0 · 797 bytes, up to 0x631bdc
Signature
void __fastcall (const float *plane, void *polygon, int32_t tag)
Meaning
Clips a polygon to the inside of a plane with a 1/720 band, tagging the vertices it adds
Confidence
verified, proof one
Finding
collision/contact#polygon-clip
Test
collision::resolve_clip_difftest

Finding: Polygon clip in collision: contact

A polygon holds up to 15 vertices (12 bytes each from +0x00), a tag per vertex (+0xb4) and a count (+0xf0). 0x6318c0(plane, poly, tag) takes s = −(n·v + d) per vertex, rounded to float. With no vertex, or every s above −1/720, the polygon is unchanged; else with every s below 1/720 it is emptied; a NaN s takes part in neither test. Otherwise each edge (prev, cur), from (last, first), is clipped with s ≥ 0 or NaN inside:

prevcuremits
inincur
outinthe crossing when s_cur > 1/720, then cur
inoutthe crossing when s_prev > 1/720
outoutnothing

A crossing takes the tag. Fewer than three vertices empty the polygon. 0x631870(planes, n, poly) clips by planes 0 to n − 1 with tag i, returning 0 once empty and 1 otherwise; 0x632980 skips one index.

The derivation is in the doc.

Callers 2

Callees 2

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