JP wrote:
> On Apr 4, 1:16 am, David Fanning <n...@[EMAIL PROTECTED]
> wrote:
>> I suppose the centroid of the polygon is the average
>> value of it vertices, or maybe the mean if you didn't
>> want to overbias outliers.
>
> I guess you meant "the average value of it vertices, or maybe the
> MEDIAN" ??
>
> In any case, thank you. I didn't realize that the centroid is just the
> mean of the vertices in the two dimensions.
It isn't. David's routine calculates the centroid of the vertices
themselves; that's not the same as the centroid of the polygon that they
define.
Consider the polygon [[0,0],[1,0],[1,1],[0,1],[0,0.5]]. It's centroid is
clearly [0.5,0.5], the same as the one for [[0,0],[1,0],[1,1],[0,1]],
but the vertices have a different average. Taking the mean of the
vertices is at best an approximation.


|