Creating a smooth nurb from list of points

2.1k views Asked by At

I am developing a 3D graphic application in which the user can draw curves. I record the curve that is drawn by the user and i would like to create a smooth nurb from the recorded set of points. I tried using the openNurbs library but i could not find a way to do the fitting using the library. How can i fit a set of points to a nurb?

1

There are 1 answers

0
fang On BEST ANSWER

First of all, I don't think you need nurbs. Fitting a B-spline curve to your data points should be good enough.

If you only have a few dozen points, then it is likely you would like the B-spline curve to exactly pass thru these data points. In this case, you are looking for spline interpolation algorithms. If this is the case, you can use Catmull Rom spline or Overhauser spline to interpolate your data points. Both will create C1 cubic splines and both are easy to implement without the need to solve a linear equation set.

If you have several hundreds of points, then it is likely that you only want the B-spline curve to lie close to the data points. Then, the algorithm you are looking for is least square fitting. You can find plenty of articles (e.g.: link1 ) in this area online. A typical algorithm for least square fitting with B-spline curve will involve these steps:

1) Choose a parametrization for your data points. Chord length parametrization is typically a good choice for least square fitting.
2) Choose the degree for the B-spline. Typically, we use degree 3, i.e., cubic B-spline.
3) Decide number of control points for your B-spline.
4) Decide the knot vector based on the information in the first 3 steps.
5) Solve a linear equation set to find the control points of the B-spline.