Hi Actually misnamed a lot of things ... they should be
y=0; ret += y; ret -= y; What John has explained is correct. This is what we do : 1. We take a line parallel to x-axis as the baseline, this is the line passing thru the starting point. 2. At each point we maitain the height above this baseline. If we move east we increase by a rectangle of 1x(height) . If we move west we decrease by a similar rectangle. Also if we go below the baseline at any time, the exact opposite will happen as intended. Try out the code with a few examples .. and try maintain which rectangle is being added .. and which is being removed. -Dhyanesh On 11/21/05, Deepak Shah <[EMAIL PROTECTED]> wrote: > > alright, this sounds very navie, but could someone give me how we are > calculating the area of polygon > > > On 11/21/05, John Fiala <[EMAIL PROTECTED]> wrote: > > > > On 11/21/05, Deepak Shah <[EMAIL PROTECTED]> wrote: > > > > > > Dhyanesh, > > > > > > Could you explain your code, I seems not to get it. > > > > > > Thx > > > > It works fine - although the x=0 should be y=0. Basically, moving > > east adds the current height to the total area, moving west subtracts > > the current height. The height increases and decreases with the north > > and south, and starts at 0. > > > > -- > > John Fiala > > >