Calculating Intersections

Hi,

I need to calculate the intersections of a set of straight lines (in radial direction) with a set of splines modeled as NURBS in OpenGL. At the present moment I need to do it only in 2D, but later I will jump to 3D.
I think that this is related to something known as Ray Tracing… My question is: Is possible to use OpennGL to actually perform this type of calculations and retrieve the intersection points?
Thanks !!!

No

No,you should compute this all by yourself

Well, it’s possible but I wouldn’t recommend it :slight_smile:
You could render a view from some point on the ray with viewport size 1x1 and read back the depth value. Note that depth buffer precision is not very high so the result will not be precise (unless you do a second pass). It’s a brute force approach and can only be suitable for few rays but since you asked if it’s possible… :slight_smile:

Contrary to previous posts, I would say YES, it is the best possible solution, but only if you need to find very large number of intersections for the same spline. For small number of tests, others are right, overhead is too big.