<p>Your edit is correct. In this context 0/0=0. This definition is repeated by David F. Rogers on page 45 of <a href="https://books.google.fi/books?id=MaW4XiScJ7cC&amp;lpg=PP1&amp;pg=PA45#v=onepage&amp;q&amp;f=false" rel="nofollow noreferrer">An Introduction to NURBS with Historical Perspective</a>. 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.</p>
<p>As a side note, this recursive B-spline function is known as <a href="https://en.wikipedia.org/wiki/De_Boor%27s_algorithm" rel="nofollow noreferrer">De Boor's Algorithm</a>.</p>

CC BY-SA 4.0
2021-06-04T07:02:29.037Z
2021-06-04T07:02:29.037Z
Joshua Kennedy
<p>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 <a href="http://web.cs.wpi.edu/~matt/courses/cs563/talks/nurbs.html" rel="nofollow noreferrer">this course</a>.</p>

<p>From a DXF file, I got the following parameters:</p>

<pre><code>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)]
</code></pre>

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

<p>Here are the formulas from the course:</p>

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

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

<p>and the recursive B-spline basis function:</p>

<p>$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)$</p>

<p>$N_{i,0}(u) = 1$ if $t_i \leq u &lt; t_{i+1}$ or $0$ otherwise.</p>

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

<p>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?</p>

<p>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.</p>

<nurbs>
drawing NURBS: knots, multiplicity, divide by zero?
tgirod
# drawing NURBS: knots, multiplicity, divide by zero?

(Asked by: username_0 on 2018-08-09)

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](http://web.cs.wpi.edu/~matt/courses/cs563/talks/nurbs.html).

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.

**Tags:** nurbs


---

## 1 answers

### Answer by username_1 on 2021-06-04. Score: 1

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](https://books.google.fi/books?id=MaW4XiScJ7cC&lpg=PP1&pg=PA45#v=onepage&q&f=false). 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](https://en.wikipedia.org/wiki/De_Boor%27s_algorithm).


---

