jon,
thanks! my polygons are only triangles and quadrilaterals at this point, but
your method works beautifully for
concave quads. I did have to change one line (which appears a few times) in
order to compile:
w += 2 * ( p[ip].y >
p[i].y ) - 1;
became:
w += 2 * (( p[ip].y >
p[i].y ) ? 1 : 0) - 1;
I am new to AS, so this may have been unnecessary or they may have been a more
elegant way to do this.
thanks again.
-eric
--- In [email protected], Jon Bradley <[EMAIL PROTECTED]> wrote:
>
>
> On Apr 7, 2008, at 8:46 AM, Jon Bradley wrote:
>
> > /**
> > * Point inside polygon using winding number method
> > * q Point2d A point 2d structure with x,y properties
> > * p Polygon A polygon as an array of points in
> > clockwise order
> > * returns Boolean Point is inside polygon if winding (w) number
> > is != 0
> > */
>
>
> Forgot to add that the parameter "p" for the polygon is a closed loop
> where p[0] == p[n].
>
> cheers,
>
> jon
>