Tell me more ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

What is the way to calculate the centroid of polygon? I have a concave polygon of 16 points, and I want know the centroid of that.

thanks

share|improve this question
6  
You've seen this? – J. M. Dec 11 '11 at 14:09
1  
As for a Mathematica routine: PolygonCentroid[pts_?MatrixQ] := With[{dif = Map[Det, Partition[pts, 2, 1]]}, ((ListConvolve[{1, 1}, #] & /@ Transpose[pts]).dif)/(3 Total[dif])]. Maybe somebody can do better than me... – J. M. Dec 11 '11 at 14:19
thanks but i will be delighted if u could a bit explain me thx – Csabi Dec 11 '11 at 14:22
4  
Explain what? The formula? The code? You're a bit vague... – J. M. Dec 11 '11 at 14:30

1 Answer

up vote 4 down vote accepted

Label your 16 points $(x_1,y_1)$ through $(x_{16},y_{16})$. Then, according to the Wikipedia article...

$$C = \left(\frac{x_1+x_2+\cdots+x_{16}}{16}, \frac{y_1+y_2+\cdots+y_{16}}{16}\right)$$

share|improve this answer
4  
I don't mind giving a quick answer, but please notice that you have not asked a good question. Sure, the wording is fine and the centroid of a polygon does need to be computed, but any research (say, on the Wikipedia page) on your part would have led you to the answer. – The Chaz 2.0 Dec 11 '11 at 15:04
1  

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.