[gameprogrammer] RES: Re: 2D math question
- From: "Edilson Vasconcelos de Melo Junior" <dirso@xxxxxxxxxxxxxxxxxx>
- To: <gameprogrammer@xxxxxxxxxxxxx>
- Date: Thu, 26 Apr 2007 22:58:09 -0300
How would I do this test? Do you have any sample code for the testing?
Thanks,
Dirso
-----Mensagem original-----
De: gameprogrammer-bounce@xxxxxxxxxxxxx
[mailto:gameprogrammer-bounce@xxxxxxxxxxxxx] Em nome de Alan Wolfe
Enviada em: quinta-feira, 26 de abril de 2007 22:18
Para: gameprogrammer@xxxxxxxxxxxxx
Assunto: [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
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.463 / Virus Database: 269.6.1/777 - Release Date: 26/4/2007
15:23
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: RES: Re: 2D math question
- From: Bob Pendleton
- References:
- [gameprogrammer] Re: 2D math question
- From: Alan Wolfe
Other related posts:
- » [gameprogrammer] RES: Re: 2D math question
- » [gameprogrammer] Re: RES: Re: 2D math question
- [gameprogrammer] Re: RES: Re: 2D math question
- From: Bob Pendleton
- [gameprogrammer] Re: 2D math question
- From: Alan Wolfe