The meaning of *knot insertion* is adding
a new knot into the existing knot vector without
changing the shape of the curve. This new knot may be equal to
an existing knot and, in this case, the multiplicity of that knot is
increased by one. Because of the fundamental equality *m = n + p + 1*,
after adding a new knot, the value of *m* is increased by one and,
consequently, either the number of control points or the degree of the curve
must also be increased by one.
Changing the degree of the curve due to the increase
of knots will change the shape of the curve globally and will not be
considered. Therefore, inserting a new knot causes a new control point to be
added. In fact, some existing control points are removed and replaced with
new ones by corner cutting.

Although knot insertion looks like not very interesting, it is one of the most important algorithms for B-spline curves since many other useful algorithms are based on knot insertion. Therefore, we shall start important algorithms with knot insertion. In the following, we shall present an algorithm for inserting a single knot, followed by an algorithm for inserting a single knot multiple times.

The left figure below shows a clamped B-spline curve of degree 4 with
uniform knots, while the right figure shows the result after a new knot
*u* = 0.5 is inserted. The left figure also shows the control polylines
before and after the insertion. As you can see, the shape of the curve does
not change. However, the defining control polyline is changed. In fact,
four new control points in red replace the original control points
**P**_{4}, **P**_{5} and **P**_{6}, and
three line segments in yellow cut the corners at **P**_{4},
**P**_{5} and **P**_{6}.

Suppose the new knot *t* lies in knot span
[*u*_{k}, *u*_{k+1}). From the
strong convex hull property, **C**(*t*) lies in the
convex hull defined by control points **P**_{k},
**P**_{k-1}, ..., **P**_{k-p} and
the basis functions of all other control points are zero.
Thus, the knot insertion computation
can be restricted on control points **P**_{k},
**P**_{k-1}, ..., **P**_{k-p}.
The way of inserting *t* is to find *p* new control points
**Q**_{k} on leg
**P**_{k-1}**P**_{k},
**Q**_{k-1} on leg
**P**_{k-2}**P**_{k-1}, ..., and
**Q**_{k-p+1} on leg
**P**_{k-p}**P**_{k-p+1} such that the
old polyline between **P**_{k-p} and
**P**_{k} (in black below) is replaced by
**P**_{k-p}**Q**_{k-p+1}...**Q**_{k}**P**_{k}
(in orange below) by cutting the corners at **P**_{k-p+1},
..., **P**_{k-1}. All other control points
are unchanged. Note that *p*-1 control points of the original
control polyline are removed and replaced with *p* new control
points.

Fortunately, the positions of new control points **Q**_{i}'s
are easy to compute. The formula for computing the new control point
**Q**_{i} on leg
**P**_{i-1}**P**_{i} is the following:

where the ratio *a*_{i} is computed as below:

In summary, to insert a new knot *t*, we first find the
knot span [*u*_{k}, *u*_{k+1})
that contains *t*. With *k* available, *p* new
control points **Q**_{k-p+1}, ...,
**Q**_{k} are computed with the above formula.
Finally, the original control polyline between **P**_{k-p}
and **P**_{k} is replaced with the new polyline defined
by **P**_{k-p}, **Q**_{k-p+1},
**Q**_{k-p+2}, ..., **Q**_{k-1},
**Q**_{k} and **P**_{k}.
Note that after inserting a new knot, the knot vector becomes
*u*_{0}, *u*_{1}, ..., *u*_{k},
** t**,

The above computation scheme can be illustrated with the following diagram.
First, the affected control points are listed on the left column. Then,
the computed new control points are listed on the second column. Note that
the number of new control points is one less than the affected control
points. The computation of new control point **Q**_{i},
where *k-p*+1 <= *i* <= *k*, requires two original control
points **P**_{i-1} and **P**_{i} with
coefficients 1-*a*_{i} and *a*_{i},
respectively. After the computation, use the points surrounded
by the blue dotted line to replace those not in the region. All unaffected
control points are preserved. Therefore, the original set of control
points **P**_{k-p}, **P**_{k-p+1}, ...,
**P**_{k-1}, **P**_{k} is replaced with
**P**_{k-p}, **Q**_{k-p+1}, ...,
**Q**_{k-1}, **P**_{k}.

Let us take a look at a geometric interpretation of *a*_{i}.
From its definition,
*a*_{i}:1-*a*_{i} is the ratio of
dividing interval [*u*_{i}, *u*_{i+p})
by the value of *t* as shown below:

There are *k* *a*_{i}'s, each of which covers
*p* knot spans (*i.e.*, [*u*_{i},
*u*_{i+p})). If we stack these intervals together and
align them at the value of *t*, we have the following diagram:

Therefore, the position of *t* divides knot spans
[*u*_{k}, *u*_{k+p}),
[*u*_{k-1}, *u*_{k+p-1}), ...,
[*u*_{k-p+1}, *u*_{k+1}) into ratios
*a*_{k}, *a*_{k-1}, ...,,
*a*_{k-p+1}, which, in turn, provide the ratios
for dividing legs
**P**_{k}**P**_{k-1},
**P**_{k-1}**P**_{k-2}, ...
**P**_{k-p}**P**_{k-p+1}.

Suppose we have a B-spline curve of degree 3 with a knot vector as follows:

u_{0} to u_{3} |
u_{4} |
u_{5} |
u_{6} |
u_{7} |
u_{8} to u_{11} |

0 | 0.2 | 0.4 | 0.6 | 0.8 | 1 |

We want to insert a new knot *t* = 0.5. Since *t*
= 0.5 lies in knot span [*u*_{5},*u*_{6}),
the affected control points are **P**_{5},
**P**_{4}, **P**_{3} and **P**_{2}.
To determine the three new
control points **Q**_{5}, **Q**_{4} and
**Q**_{3}, we need to compute *a*_{5},
*a*_{4} and *a*_{3} as follows:

The three new control points are

The new control polyline becomes **P**_{0}, **P**_{1},
**P**_{2}, **Q**_{3}, **Q**_{4},
**Q**_{5}, **P**_{5}, ...., and the new knot vector
is

u_{0} to u_{3} |
u_{4} |
u_{5} |
u_{6} |
u_{7} |
u_{8} |
u_{9} to u_{12} |

0 | 0.2 | 0.4 | 0.5 |
0.6 | 0.8 | 1 |

Since the original B-spline curve has *p* = 3 and *m* = 11,
we have *n* = *m* - *p* - 1 = 11 - 3 - 1 = 7 and hence
8 control points. The following is a B-spline curve satisfying this
condition and its basis functions:

The three blue rectangles are **Q**_{3}, **Q**_{4} and
**Q**_{5}. After inserting *t* = 0.5, the corners at
**P**_{3} and **P**_{4} are cut, yielding the
following B-spline curve and its basis functions. Note that the shape of
the curve does not change:

The following diagram shows the relationship between the old and new
control points. Note that the new set of control points contains
**P**_{0}, **P**_{1}, **P**_{2},
**Q**_{3}, **Q**_{4}, **Q**_{5},
**P**_{5}, **P**_{6} and **P**_{7}.

The relationship among *a*_{j}'s,
*u*_{j}'s, and *t* are shown below:

u_{0} to u_{4} |
u_{5} |
u_{6} |
u_{7} |
u_{8} |
u_{9} |
u_{10} |
u_{11} |
u_{12} to u_{16} |

0 | 0.125 | 0.25 | 0.375 | 0.5 | 0.625 | 0.75 | 0.875 | 1 |

We want to insert a new knot *t* = 0.5, which is equal to an
existing one (*i.e.*, *t* = *u*_{8} = 0.5).
The following is a B-spline curve of degree 4 and its basis functions
*before* the new knot *t* is inserted.

Since *t* is in [*u*_{8},*u*_{9}),
the affected control points are **P**_{8}, **P**_{7},
**P**_{6}, **P**_{5} and **P**_{4}.
The coefficients are computed as follows:

The new control points are

The new control point **Q**_{8} is equal to
the original control point **P**_{7}. In fact, if *t*
is equal to a knot, say *u*_{k}, then

Consequently, we have

That is, **if the new knot t to be
inserted is equal to an existing simple knot u_{k}, then
Q_{k}, the last new control point, is equal to
P_{k-1}**.
The following diagram shows the computation scheme:

The figure shown at the beginning of this example shows the new control
points and the new control polyline in orange, Note that the new
control points are
**P**_{0}, **P**_{1}, **P**_{2},
**P**_{3}, **P**_{4},
**Q**_{5}, **Q**_{6},
**Q**_{7}, **Q**_{8} = **P**_{7},
**P**_{8}, **P**_{9}, **P**_{10}
and **P**_{11}. The curve and its basis functions *after*
the new knot *t* = 0.5 is inserted is shown below.

The relationship among *a*_{j}'s,
*u*_{j}'s, and *t* are shown below:

What if the new knot *t* is inserted at a *multiple* knot?
Suppose *t* is inserted at knot *u*_{k} of
multiplicity *s*. Hence, we have *s* consecutive equal knots:
*u*_{k} = *u*_{k-1} =
*u*_{k-2} = .... = *u*_{k-s+1} and
*u*_{k-s+1} being not
equal to *u*_{k-s}. In the computation of
coefficients *a*_{k}, ....,
*a*_{k-p+1}, we have the following:

Hence, coefficients *a*_{k}, ....,
*a*_{k-p+1} are all zero and, consequently, we have

This shows that **if the new knot t is
inserted at a knot u_{k} of multiplicity s,
then the last s new control points, Q_{k},
Q_{k-1}, ..., Q_{k-s+1} are
equal to the original control points P_{k-1},
P_{k-2}, ..., P_{k-s}.
** If