Polygon
The equations of simgeometry.objects.polygon, declared on the code that implements them and checked by the tests.
Polygon
classsourceRepresent a polygon geometry object.
- inside
- level set
- Assumes
- the even-odd (crossing-number) rule along a ray towards , not a winding number; is the vertex before , the closing edge implied
- half-open in , so a vertex on the ray is counted once; guards horizontal edges
- inside also needs the half-open bounding box ; the compiled kernel
contains_polygon_2druns the test - : the distance to the nearest edge, negative where
contains_pointsis true; exact for a simple polygon
- References
- W. R. Franklin, PNPOLY - Point Inclusion in Polygon Test
- M. Shimrat, Algorithm 112: Position of point relative to polygon, Commun. ACM 5, 434 (1962)
- Quílez, 2D distance functions