[Math] the general formula for NURBS curves

bezier-curveplane-curves

Give me the general mathematical formula for NURBS curves, with special cases (B-spline and Bézier curves)

Best Answer

Suppose we have a sequence of $n$ 3D control points $\mathbf P_1, \mathbf P_2, \ldots, \mathbf P_n$, and corresponding weights $w_1, w_2, \ldots, w_n$. If we want a NURBS curve of degree $m$ (order $k = m+1$), then we need $n+k$ knots $t_1, \ldots , t_{n+k}$. Then the NURBS curve is given by the formula $$ \mathbf C(t) = \frac{\sum_{i=1}^n N_i(t)w_i \mathbf P_i}{\sum_{i=1}^n N_i(t)w_i} $$ where $N_i(t)$ is the $i$-th b-spline basis function of degree $m$ constructed from the knots $t_1, \ldots , t_{n+k}$.

If all the $w_i$ are equal, then they cancel out, and we get the polynomial b-spline $$ \mathbf C(t) = \sum_{i=1}^n N_i(t)\mathbf P_i $$ If the knots are of the form $(a,a, \ldots, a,b,b,\ldots,b)$ --- $k$ $a$'s followed by $k$ $b$'s, then the b-spline curve has only a single segment, which means that it's a Bezier curve.