Re: problem computing area [message #68123] |
Mon, 05 October 2009 17:56  |
aetherlux
Messages: 12 Registered: July 2006
|
Junior Member |
|
|
On Oct 5, 9:02 am, jameskuyper <jameskuy...@verizon.net> wrote:
> 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.
After applying "reverse" of the x and y vectors I have obtained a
correct positive area. It is weird. I have tested this routine with a
bunch of different contours working in the same way and the area is
positive without need of being counter-clockwise.
So, although I have not a clear idea about what was going wrong, now
it is solved.
Thank you very much.
|
|
|