Expand description
Polygon operations: area, centroid, convex hull, winding.
All functions operate on slices of (f64, f64) tuples for
maximum compatibility. Use Point2::to_tuple() for interop.
§References
- O’Rourke (1998), “Computational Geometry in C”, Ch.1 (polygon area)
- Graham (1972), “An efficient algorithm for determining the convex hull”
- de Berg et al. (2008), “Computational Geometry”, Ch.1
Functions§
- area
- Computes the unsigned area of a simple polygon.
- area_
with_ holes - Computes the unsigned area of a polygon with holes.
- centroid
- Computes the centroid (center of mass) of a simple polygon.
- centroid_
with_ holes - Computes the centroid of a polygon with holes.
- contains_
point - Checks if a point lies inside a simple polygon using the winding number method.
- convex_
hull - Computes the convex hull of a set of points using Graham scan.
- ensure_
ccw - Ensures a polygon has counter-clockwise winding order.
- is_
convex - Checks if a simple polygon is convex.
- perimeter
- Computes the perimeter of a polygon.
- signed_
area - Computes the signed area of a simple polygon using the Shoelace formula.