PDA

View Full Version : Finding intersection of a ray with arbitrary surface



esapir
07-17-2014, 10:55 AM
I want to check if a user clicked on a surface. In this case the surface is a coons patch.

What should be the algorithm to finding an intersection of the click point (a ray) with the surface?

Lolilolight
07-19-2014, 09:55 AM
Maybe you can loop on all the triangles of your surface and use the "raytracing" algorithm. (This is how I do)

carsten neumann
07-19-2014, 12:12 PM
Not considering practicality or efficiency you have a surface S(u,v) parameterized by (s,t) and a ray R(u) parameterized by u and you are looking for values s,t,u such that S(s,t) = R(u). In other words you have a system of three equations for three unknowns that you can solve to find the intersection point(s).
I don't know enough about Coons patches to say if there is a better/different algorithm.