Re: Polygonflow: clockwise or counter-clockwise?

2010-02-04 Thread Michael Kristensen
Thanks to Jeff and Alex for your replies Alex, your script worked perfectly. Thanks I needed to do the check in two cases: 1. I needed to calculate the area of multiple polygons by "stringing" them together in one superpolygon. If they did'nt have the same flowdirection the calculation would

Re: Polygonflow: clockwise or counter-clockwise?

2010-02-03 Thread Alex Tweedly
Alex Tweedly wrote: I'll post a couple of suggested solutions shortly (once I've got the stack running properly) There are two approaches (at least) that consistently get the same answers as we all intuitively "know" are correct. By AREA. Calculate the (signed) area between each edge and

Re: Polygonflow: clockwise or counter-clockwise?

2010-02-03 Thread Jeff Massung
On Wed, Feb 3, 2010 at 6:22 PM, Alex Tweedly wrote: > Jeff Massung wrote: > >> Michael, >> >> Sorry, but the problem you are running into is that (in your second >> example) >> >> > The examples were from me (Alex) not Michael :-) > > Lol

Re: Polygonflow: clockwise or counter-clockwise?

2010-02-03 Thread Alex Tweedly
Jeff Massung wrote: Michael, Sorry, but the problem you are running into is that (in your second example) The examples were from me (Alex) not Michael :-) you are working with a concave polygon instead of convex. Yes. Exactly. There *are* polygons which are concave. We could all look at th

Re: Polygonflow: clockwise or counter-clockwise?

2010-02-03 Thread Jeff Massung
Michael, Sorry, but the problem you are running into is that (in your second example) you are working with a concave polygon instead of convex. I promise, using the cross-product is correct. Concave polygons get tricky, because the winding actually does - in fact - change direction. You - as a hu

Re: Polygonflow: clockwise or counter-clockwise?

2010-02-03 Thread Alex Tweedly
Jeff Massung wrote: Michael, I assume you are talking about 2D polygons... Just take a 3D cross product of the first two vector (P3 - P2) x (P2 - P1). If the resultant vector is coming out of the screen (Z < 0) then the polygon is counter-clockwise. If it is going into the screen (Z > 0) then t

Re: Polygonflow: clockwise or counter-clockwise?

2010-02-03 Thread Jeff Massung
Michael, I assume you are talking about 2D polygons... Just take a 3D cross product of the first two vector (P3 - P2) x (P2 - P1). If the resultant vector is coming out of the screen (Z < 0) then the polygon is counter-clockwise. If it is going into the screen (Z > 0) then the polygon is clockwis

Polygonflow: clockwise or counter-clockwise?

2010-02-03 Thread Michael Kristensen
HI THERE Can you figure a smart way to check if the flow of a polygon goes clockwise or counter-clockwise? Thanks Michael ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage you