2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.