# drawing NURBS: knots, multiplicity, divide by zero?

I'm trying to grasp how NURBS curves work. I think I understand the principle, but I'm unsure about the formula. Here, I base myself on this course.

From a DXF file, I got the following parameters:

knots (7): [0,0,0,0.5,1,1,1]
degree: 2
closed: false
control points (4): [(0,0), (-50,112.5), (150,112.5), (100,0)]


The knots vector looks good : non-decreasing, length of #controls + degree + 1, max multiplicity of degree+1.

Here are the formulas from the course:

$C(u) = \frac{\sum_{i=0}^n{w_i P_i N_{i,k}(u)}}{\sum_{i=0}^n{w_i P_i}}$

• $w_i$ : weights
• $P_i$ : control points (vector)
• $N_{i,k}$ : normalized B-spline basis functions of degree k

and the recursive B-spline basis function:

$N_{i,k}(u) = \frac{u-t_i}{t_{i+k} - t_i} N_{i,k-1}(u) + \frac{t_{i+k+1}-u}{t_{i+k+1}-t_{i+1}} N_{i+1,k-1}(u)$

$N_{i,0}(u) = 1$ if $t_i \leq u < t_{i+1}$ or $0$ otherwise.

What I don't get is the fraction in the $N_{i,k}(u)$ function.

Let's take $i=0$ (calculating the influence of the first control point over the curve, if I understand correctly): because of the multiplicity, I've got $t_{i+k} = t_2 = 0$ and $t_i = t_0 = 0$, which makes me divide by zero ... What am I missing?

EDIT: As usual, writing down the problem helps to solve it. By re-reading the material linked above, I realized I missed one line: 0/0 fractions should be considered as 0, not NaN. Is this right ? At least on the few toy examples I tried, my drawing matches the original DXF version.

Your edit is correct. In this context 0/0=0. This definition is repeated by David F. Rogers on page 45 of An Introduction to NURBS with Historical Perspective. Even luckier the page is available on Google Books. If you look at the references for the webpage you linked you'll see he is also cited there.

As a side note, this recursive B-spline function is known as De Boor's Algorithm.