PointInPolygonProjected
function · cmath · primitive
- Address
0x7c23e0· 272 bytes, up to0x7c24ef- Signature
uint8_t __fastcall (const NTempest::C3Vector *point, const NTempest::C3Vector *verts, uint32_t n, uint32_t axis)- Meaning
- Returns 1 when a point lies inside a polygon projected along a dominant axis, by crossing count
- Confidence
- verified, proof two
- Finding
- cmath/geometry#point-in-polygon
- Test
cmath::point_in_poly_difftest,cmath::raymesh_composed_difftest,terrain::portal_screen_rect_difftest,models::aabsp_nearest_dist_difftest
Finding: Point in polygon in cmath: intersections
0x7c23e0(n, axis) tests the point in ecx against n vertices (flat floats, stride 12, in edx)
by the crossing count after dropping coordinate axis: the two kept coordinates are A = tab[axis].a
and B = tab[axis].b from the table 0xcf5c7c, set by the initializer 0x7c18d0 to (2, 1) for axis 0,
(0, 2) for axis 1 and (1, 0) for axis 2. For each edge from the previous vertex (the last for the first)
to the current, with side(V) = V.A ≥ Q.A (false for NaN): a change of side compares
(Vprev.B − Vcur.B)·(Vcur.A − Q.A) with (Vcur.B − Q.B)·(Vprev.A − Vcur.A), and the accumulator toggles when
term2 ≤ term1 equals the current side. n of 0 gives 0.
The derivation is in the doc.
Callers 4
- CMapObj::CrossPortals models
- ProjectPortal terrain
- MapObjPortalPointDistance models
- IntersectRayPolygonTriangle cmath
Callees 0
None by a direct call or jump.
Calls and jumps by a bare address, from tables/calls.tsv.