Skip to main content

centroid_polygon

Function centroid_polygon 

Source
pub fn centroid_polygon(polygon: &Polygon) -> Result<Point>
Expand description

Computes the area-weighted centroid of a polygon

Uses the signed area method to compute the true geometric centroid accounting for the area distribution within the polygon.

§Arguments

  • polygon - Input polygon

§Returns

Point representing the centroid

§Errors

Returns error if polygon is invalid or has zero area