Hello Robert, The standard method to determine polygon orientation is indeed by calculating the area. Depending on the exact implementation of the formula, counter/anti-clockwise polygon have a negative area and clockwise are positive (or vica-versa). The only optimisation that I am aware of is that you can dispense with the computationally expensive sqrt() function - after all, your not interested in the area value - just whether it's +ve or -ve. Note that this method only works with well formed polygons - no self intersection or bow ties - anomalies which will cause +ve and -ve areas within the polygon which may cancel each other or give the incorrect overall sign.
Regards, Warren Vick Europa Technologies Ltd. http://www.europa-tech.com -----Original Message----- From: Robert Crossley [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 24, 2002 12:33 AM To: MapInfo List Subject: MI-L Polygon direction Hi all, A while ago, I asked a question about an external function to calculate the area of a polygon and got some good references. I ended up using the gauss-green function based on the formula: Area=(Sum(y(n)-y(n+1))*(x(n)+x(n+1)))/2 . At the time, there was also some talk of polygon direction, that didn't seem to worry the results. I now find that that is because as a right hander, i naturally digitised in a clockwise direction. On further testing, if I digitised in a counter-clockwise direction I was getting a negative (but seemingly correct area?) area. So I thought I should put a direction test into the code, and a search of the archives showed that there was a test for direction as well. But the test seemed to be the gauss-green area calculation, and if it returned a positive number it was clockwise, and a negative number was counter-clockwise. So am I correct in assuming that the area is the positive value of the calculated area from the gauss-green formula and forget about trying to work out the direction? THanks Robert. Robert Crossley Robert Crossley & Associates 9 Short St New Brighton NSW 2483 AUSTRALIA P: 02 6680 1309 F: New Connection M: 0419 718 642 E: [EMAIL PROTECTED] --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
