Finding the centeroid of a polygon?

Posted by user146780 on Stack Overflow See other posts from Stack Overflow or by user146780
Published on 2010-05-08T00:34:23Z Indexed on 2010/05/08 0:38 UTC
Read the original article Hit count: 539

Filed under:
|
|
|

I have tried: for each vertex, add to total, divide by number of verities to get center.

I'v also tried: Find the topmost, bottommost -> get midpoint... find leftmost, rightmost, find midpoint.

Both of these did not return the perfect center because I'm relying on the center to scale a polygon.

I want to scale my polygons so I may put a border around them.

What is the best way to find the centroid of a polygon given that the polygon may be concave, convex and have many many sides of various lengths.

Thanks

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++