Re: problem computing area [message #68129 is a reply to message #68123] |
Mon, 05 October 2009 08:02   |
jameskuyper
Messages: 79 Registered: October 2007
|
Member |
|
|
aetherlux wrote:
> Hi everybody,
>
> I am trying to compute the area of this figure with
> IDLanROI:ComputeGeometry
>
> http://juan.gulo.org/area2.png
>
> but I obtain a negative area. I have checked it and there is not lines
> crossing over others. For the "horizontal" part of the figure the line
> begins and finishes in negative values of "y" (that is, the first and
> last point), but is it a problem?
>
> Ideas? I have been looking at it all the weekend but I don't have any
> clue about the possible problem.
A closed planar curve can represent either the area inside the curve,
or the area outside the curve; the distinction is typically
represented by listing the points either in the clockwise or counter-
clockwise order around the curve. I'm not sure which convention is
used by IDLanROI. The formula usually used for calculating the area
gives you a positive value when the points are in the correct order,
and a negative value of the same magnitude when the points are in the
wrong order. If the number you are getting seems to have the correct
size, but the wrong sign, you may simply have listed the points on the
curve in the wrong order.
If the size of the number is wrong, then you have some other problem.
For instance, the points on the upper parabolic curve must be listed
in the opposite order of x values, than the points on the bottom
curve; if the upper one is in the wrong order, you'll get a negative
number, but one that is not simply the negative of the correct number.
In order to figure out what really is going wrong here, we need to see
how your code for creating the IDLanROI object - which is what David
was elliptically referring to.
|
|
|