comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: problem computing area

Re: problem computing area
type: item
description: aetherlux writes: > 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. The code you are using is incorrect. :-) 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.")
creator: David Fanning
date: 2009-10-05T12:05:09-00:00

Re: problem computing area
type: item
description: 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.
creator: jameskuyper
date: 2009-10-05T15:02:00-00:00

Re: problem computing area
type: item
description: 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 positiv…
creator: aetherlux
date: 2009-10-06T00:56:04-00:00