[Tutor] Point in polygon intro please~!

Kent Johnson kent37 at tds.net
Sat Oct 7 15:23:01 CEST 2006


Michael Shulman wrote:
> Hello, I'm very new to both python and OpenGL, but I'm catching on 
> pretty quick,
> and trying to make a little game.  I'm stuck on being able to do this 
> point-in-polygon test though. 
> Everyone seems to say that I should create a ray and see how many sides 
> of a polygon it intersects, (even vs odd)
> but I have no idea how to go about setting this up.

Googling 'python point polygon' finds quite a few useful pages including 
this Python implementation:
http://www.ariel.com.au/a/python-point-int-poly.html

Other links of interest:
http://www.faqs.org/faqs/graphics/algorithms-faq/ see 2.03
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html

Kent



More information about the Tutor mailing list