Expand description
Collision and intersection: point-in-polygon, segment-polygon, circle-polygon, polygon-polygon (SAT), convex hull, convexity test.
Functions§
- circle_
intersects_ polygon - Whether a circle intersects a polygon (edge or interior).
- convex_
hull - Andrew’s monotone chain convex hull algorithm.
- is_
convex - Whether a simple polygon is convex.
- point_
in_ polygon - Ray-casting algorithm: does a horizontal ray from
pcross the polygon edge an odd number of times? - polygons_
intersect - Separating Axis Theorem: do two convex polygons overlap? Panics if either polygon is concave (SAT is only valid for convex polygons).
- segment_
intersects_ polygon - Whether a line segment intersects a polygon.
- segments_
intersect - Whether two line segments intersect (proper or improper).
- winding_
number - Winding number algorithm: returns winding number of polygon around
p. 0 = outside, nonzero = inside (with winding semantics).