PDA

View Full Version : splines



03-25-2003, 03:49 AM
I am trying to figure out how to get a smooth spline with more then 4 points using openGl evaluators. Anyone know how to do this?

shinpaughp
03-25-2003, 11:34 PM
The red book has good examples. But, you should probably read up on Bezier curves or NURB curves. Search Google.

03-26-2003, 12:15 AM
Yes but the examples in the redbook and most others all use only 4 control points. I have been able to modify the code and get a spline with C2 continuity over 8 control points, but errors eventually come up. I am wondering about code to do any number of control points.

mr_coolio
03-26-2003, 01:27 AM
A basic bezier curve is defined by four points - start and end points and the tangents there. So to get a smooth curve through n points you create a bezier segment to cover each [n,n+1] and further specify that the tangent at point n is the same whether you're arriving or leaving it(actually not the same but precisely opposite).

hope this is helpful.

03-26-2003, 01:57 AM
Yes I understand that. I am able to make splines that can handle up to n vertices if I do all the math myself. However I can't get openGL to do that. I am looking for code that can handle n vertices for any type of spline in openGL.

shinpaughp
03-26-2003, 11:15 PM
You could try looking at the source code from http://www.codeproject.com/useritems/CadSurf.asp . It uses bezier curves. It may or may not help you, but it looks like a decent app.