10002

[highlight]Solution:[/highlight]
Centroid of polygon

The centroid of a non-self-intersecting closed polygon defined by n vertices (x0,y0), (x1,y1), …, (xn−1,yn−1) is the point (Cx, Cy), where

Cx= 1/6A *sumof((X_i+X_i+1)*(X_i*Y_i+1 – X_i+1 * Y_i)); fori=0 to n-1

Cy= 1/6A *sumof((Y_i+Y_i+1)*(X_i*Y_i+1 – X_i+1 * Y_i));for i=0 to n-1

and where A is the polygon’s signed area,

A = 1/2 * sumof(X_i*Y_i+1-X_i+1*Y_i);

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *