# cubic spline to NURBS

Folks,
I have searched this forum and the web. Not finding what I assume (bad idea i know) is a common need I am making this post. I have a set of data through which I would like to draw a smooth curve; i.e. a cubic spline. I have found some algorithms for calculating the required information to generate such a curve at any arbitrary resolution. (Numerical Recipes in C from Press et al)

However, I would like to somehow generate the information required for a NURBSpline that would pass through the points, as NURBS are directly supported in OpenGL.

I can’t be the first to want to do this. Does anyone know how to:

Generate a NURBS that passes through N known points.

Thanks

• Andy

i don’t think nurbs can be made to interpolate knots without loosing C2 continuity (keep the curve smooth), but i can be wrong.

for sure it involves tweaking the knot weight and maybe even the multiplicity…

to interpolate points on a function i would use the catmull-rom spline. here you can get some infos:

it is simpler to use and need less math: give it the knots to be interpolated and sweep t from 0 to 1.

Thanks,
I guess I was trying to avoid creating my own tesselation. My data is simple enough that I was hoping to simply create a NURBS which OpenGl can display without further manipulation. If I need to define my own tesselation, my data can easily be used to generate two roughly parallel Cubic splines, but then as with any curve not a bezier spline or nurbs I have to tesselate things myself.

This has always been my one issue with NURBS. They are easy to manipulate, but data generated by engineering processes (my data is streamlines which will be combined to generate a stream tube) is rarely in a form which lends itself to creating a NURB. Some sort of polynomial or cubic spline which passes directly through each point is more appropriate and is usually easy to define. Transforming that into a NURBS which is what the graphics package is looking for is not straight forward at all.

I’ll keep digging. I am currently simply taking data points from two adjacent streamlines and creating a polygon. A bit ugly but it will do for now.

Thanks again

• Andy

if a tube is what you need, then look for frenet frame.
i can give some catmull-rom/B spline code i have if you need it to start.