Bessel curve has met most of our needs by drawing curves in computer, but it has some disadvantages, such as moving a control point will lead to changes in the whole curve, that is, the direction of the curve cannot be locally controlled. Therefore, B-spline curve emerges to solve the defects of Bessel curve.

For those of you who are not familiar with bezier curves, check out another article I wrote before, “Understanding bezier Curves in Depth,” which assumes that you already know and understand bezier curves.

What is a B-spline?

Before we explain b-splines, we need to explain what a spline is. A spline is a flexible band that generates a smooth curve through a specified set of points. Simply put, a B-spline curve is a curve that locally controls its shape through a control point. Those who do not understand can check the influence of control points on curve drawing in b-spline curve through the demo at the bottom of this article.

B-spline curve is much more complicated than Bezier curve design. Let’s compare the differences between Bezier curve and B-spline curve by their formulas:

Bezier curve:


B spline curve:


A brief introduction to the composition of the above formula:

  • Represents the point coordinate vector on the curve.
  • For the control pointsThe number.
  • Is the coordinates of control points (Starting at 0).
  • Is the polynomial coefficient of control point coordinate influence weight (whereRepresents the index of coordinates,Represents the highest power of the polynomial).
  • Number of times affecting b-spline curve:It’s the degree of the curve.
  • Is the value of the curve.

Looking closely at these two formulas, we can see the following similarities:

  • It’s all summation formulas.
  • There is aIn the formula, Bezier curve x=n, B-spline curve x=d).

The following differences can be seen:

  • Bessel curves have polynomial powers consistent with the number of control points, while B-spline curves have more free polynomial powers.
  • Bessel curveThe value of is fixedAnd the B-spline curve is between the maximum and minimum node values.

Computational polynomial

Everything else in the formula is pretty clear, but the key is to figure out which polynomialWhat is!

To calculate this polynomial, we use the Cox-DeBoor recursive formula, which is as follows (it should be noted that when the denominator is 0, the whole value should be treated as 0) :



As can be seen from this formula, the differences of recursive formulas are mainly reflected inandThe value of theta. One thing to noteNumber of nodesIs by the parameterandThe quantity is equal to. According to these nodesThe value of, can be divided into the following three types:

  • Uniform periodicity
  • Open uniform
  • Non-uniform

Surely everybody is already very giddy now 🤪, this all what at sixes and sixes of, it is a formula completely, do not understand! B splines are very difficult to make sense of, because there are so many of them, and the parameters are very freely controlled. So I still explain the calculation process through the chestnut 🌰 to let you better understand it!

Class 1: Uniform periodic B-spline curve

As the name suggests, uniformly periodic B-spline curves are nodesIt’s uniform, for example[-1, -0.5, 0, 0.5, 1], as long as each adjacent value interval is the same. But for the sake of calculation, it usually starts at 0 and is spaced at 1. Such as[0, 1, 2, 3, 4, 5, 6, 7, 8].

Uniform selection of node values results in periodic distribution of each polynomial function, and I will use a uniform quadratic B-spline to help you understand this periodicity.

1. Determine the parameters of the formula

Since it is a quadratic B-spline curve, we can determine the following parameters:

  • The curve is quadratic, so, so.
  • The number of control points is manually set to 4 (it can also be set to other values), i.e.
  • nodeAs the number of, the value is 7, so the node range is:[0, 1, 2, 3, 4, 5, 6].

Now that we’ve determined these values, we’re ready to evaluate our polynomial B. Here is the iteration formula:



2. Compute polynomials for constant values

First of all according to the aboveFormula 1, we can get the polynomial of constant value first,,,:

  • When:

  • When:

  • When:

  • When:

Because the b-spline curve formula is:


It is easy to see from the above equation that we need to know the functions of the following polynomials:

So we’re going to solve for each of these polynomials in turn.

3. Compute polynomials of infinite quantities

oThe value of (i.e) :


So from the above equation, we need to getandThe value of the.

oThe value of (i.e) :


oThe value of (i.e) :


conclusion

If we keep iterating, we can figure outA:


o..The value of the

The solving process of these three polynomials andConsistent, interested partners can calculate their own, deepen understanding. I’m just going to give you the final result.




Plot the four functions separately in the coordinate system, and you can see that the shape of the image is exactly the same, but shifted along the x axis, as shown below.

:

:

:

:

4. Determine the curve equation.

The equation of the curve has been calculated as follows:


Plug the above polynomial into the equation, and you get the final equation of the curve. And then we take t from 0 to 6, and the set of points that we want is the uniform periodic B-spline.

From the value of polynomials, we can see that one of the characteristics of B-spline curves is that the control points do not affect the drawing of the whole curve, but only affect the direction of the curve locally.

The last

I have written an online demo to show the drawing of uniform periodic B-spline curves, if you are interested in it.

In the next part, I will introduce the drawing process of the remaining two b-splines. Stay tuned!