PDA

View Full Version : Ray intersect surface



Irena
02-11-2010, 02:44 PM
What is an effective/fast way to find if the ray intresect
surafce.Does OpenGL provide this functionality?
I have lots of surfaces (each surface given by the vertexes,their ordering CW/CCW is not known)

Thanks in advance for the answers!

Pziko
02-11-2010, 06:57 PM
OpenGL does not provide this functionality, it just draws stuff. Google "Ray Polygon intersection" and you'll find lots of resources out there. If you want a library that supplies this functionality, try CGAL (http://www.cgal.org/)

strattonbrazil
02-12-2010, 09:51 AM
It depends on what you actually need the ray intersection for. If you need a fully functional ray intersection test for individual polygons--even the ones off screen and occluded by other polygons--you'll need a library for that as Pziko suggested.

However, if you're doing something simpler than that like "which primitive is under my mouse?" that can be done much easier.

http://www.opengl.org/resources/faq/technical/selection.htm

This is a page that explains the limited selection support OpenGL provides. You can google other methods like OpenGL stencil selection. I would only use a separate ray intersection library if you really had a good use for it.