[gameprogrammer] Re: 2D math question

since you know the polygon is convex, one way to do it would be to use
the normal of each line segment to see if the point you are testing is
on the inside or outside of the line. like this pseudo code

int i =0;

while i < numverts and the point tested is on the inside of the line
segment defined by point i and i+1
 i++;

if(i<numverts)
 point is outside the polygon
else
 point is inside the polygon




On 4/26/07, Edilson Vasconcelos de Melo Junior <dirso@xxxxxxxxxxxxxxxxxx> wrote:
Is there any generic math expression I could use to know if a given point Po
(xo, yo) belongs to/is inside of convex polygon with 'n' vertex (where n >
2)? Maybe if I have have a function for n==3, I could split my polygon in
several triangles, right?

Thanks,
Dirso


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html




---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: