ClipPolygonByPlanes
function · collision · orchestration
- Address
0x631870· 77 bytes, up to0x6318bc- Signature
uint32_t __fastcall (const float *planes, uint32_t count, void *polygon)- Meaning
- Clips a polygon by each plane in turn, returning 0 once it is empty
- Confidence
- verified, proof one
- Finding
- collision/contact#polygon-clip
- Test
collision::sibling_pure_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:
| prev | cur | emits |
|---|---|---|
| in | in | cur |
| out | in | the crossing when s_cur > 1/720, then cur |
| in | out | the crossing when s_prev > 1/720 |
| out | out | nothing |
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 3
- FacetsMeetPlanes collision
- FindNearestFacet collision
- AverageGroundNormal collision
Callees 1
- ClipPolygonByPlane collision
Calls and jumps by a bare address, from tables/calls.tsv.