Number of control points for spline curve B

I am trying to use a spline B curve snap. The B spline curve order is 4. When I have a lot of control points it works well. However, if the number of checkpoints is small, such as two, my program will crash. I understand that the number of breakpoints is related to the number of nodes and the order. Can anyone help me clarify the relationship or provide some links to it?

+3


source to share


3 answers


It looks like you are just reading outside, which is not a specific issue for calculating splines. To calculate the b-spline, n

you need at least n + 1

.

To simplify and show the problem:

  • The easiest way to interpolate is linear interpolation - just draw a line between two points.

  • If you only have one point, you can't interpolate anything, simply because you don't know where to draw.

  • For quadratic interpolation, you need at least three points, etc.

  • Likewise, you will need at least 5 points for a 4th degree b-spline.



A really nice online demo can be found here :

Example screenshot of NURBSdemo.swf

  • Select any b-spline demo at the bottom left of the screen, I'll just fit for linear.
  • On the right, you can now set the number of control points as well as the degree of the curve.
  • Feel free to give it a try as well as move the points around with your mouse.
+3


source


Two control points are not enough to define a B-spline of order 4. For B-splines, the number of nodes must be equal to the sum of the number of control points and the order. One B-spline segment of degree 3 requires 4 control points and 8 nodes. So, to compute a B-spline of order N, you need at least N points. This will give you a B-spline with one segment. If you have more points, then the resulting B-spline will have more segments.



+3


source


As others have argued, the number of breakpoints is equal to the number of nodes minus the order of bspline. So you cannot have an arbitrary combination of order, say k, and knot vector for your bspline function / curve, once you fix the control points.

A very useful reference for theory on b-splines and nurbs curves is this: http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/index.html

Here you can find the ratio of the number of control points to the dimension of the vector of nodes, etc., as well as detailed examples and some algorithms.

Depending on your needs, you can also check the "NURBS Book" by Pieglem and Tiller http://www.amazon.com/NURBS-Book-Monographs-Visual-Communication/dp/3540615458

they did a wonderful job and in their book they include working algorithms.

The problem of fitting a b-spline curve to the data is quite a big subject as you have to take care to avoid over / fitting. There are several approaches, and most of them involve curvature penalties. The literature is extensive, but you can find a lot of information and a great starting point in Hastie et. and others. "Elements of Statistical Learning" which you can legally download from the authors site: http://statweb.stanford.edu/~tibs/ElemStatLearn/

The curve fitting problem is covered to some extent in all the links I gave. Good luck.

+2


source







All Articles