Re: pollyfillv, area of a blob, etc... [message #59578] |
Thu, 03 April 2008 07:16  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
JP writes:
> by the way, I would be happy if at least I could calculate the
> centroid of each polygon and then get the array index for each
> centroid.
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. In your case, you could
probably just pick a vertex and be pretty darn close
to it. :-)
> But I don't know how to calculate the centroid (Coyote's procedure
> CENTROID works with an array, not with a polygon).
>
> And if I had the centroid, how do I easily get the array index?
ROUND would probably work. :-)
Or, if you polygons were in some other coordinate system,
you will have to convert from that system to device coordinates.
CONVERT_COORD will be helpful.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
|
Re: pollyfillv, area of a blob, etc... [message #59664 is a reply to message #59578] |
Thu, 03 April 2008 16:08  |
JP
Messages: 55 Registered: April 2008
|
Member |
|
|
On Apr 4, 1:16 am, David Fanning <n...@dfanning.com> 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.
I'll solve my problem that way.
Cheers,
JP
|
|
|