Hello Jacques, Here's my stock function. You pass in the object and the polygon number.
Regards, Warren Vick Europa Technologies Ltd. http://www.europa-tech.com function IsClockwise(byval TestObj as object, byval Part as smallint) as logical dim NrPnts, i as integer dim a, x, y, Old_x, Old_y as float dim rc as logical rc = FALSE NrPnts = objectinfo(TestObj, OBJ_INFO_NPOLYGONS+Part)-1 Old_x = objectnodex(TestObj, Part, 1) Old_y = 0.0 a = 0.0 'print Part+": Pnts = "+NrPnts i = 1 while i <= NrPnts i = i + 1 a = a + (Old_x - objectnodex(TestObj, Part, i)) * (Old_y + objectnodey(TestObj, Part, i) - objectnodey(TestObj, Part, 1)) Old_x = objectnodex(TestObj, Part, i) Old_y = objectnodey(TestObj, Part, i) - objectnodey(TestObj, Part, 1) wend a = a + (Old_x - objectnodex(TestObj, Part, 1)) * Old_y if a < 0.0 then 'print "CLOCKWISE" rc = TRUE else 'print "ANTI-CLOCKWISE" end if IsClockwise = rc end function -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Jacques Paris Sent: Monday, January 21, 2002 9:12 PM To: MIL Subject: MI-L MB: polygon drawing direction. I would like to learn about a simple way to find if a polygon was drawn clockwise or counter clockwise. I would rather not go through lengthy calculations (someone mentioned some sum of angles) but I will be thankful for any answer. Jacques Paris e-mail [EMAIL PROTECTED] MapBasic-MapInfo support http://www.paris-pc-gis.com _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body. _______________________________________________________________________ List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, send e-mail to [EMAIL PROTECTED] and put "unsubscribe MapInfo-L" in the message body.
