5. Rational curves¶
There is an objective to describe most of the applied curves in a common, standardized way.
NURBS - Non-Uniform Rational B-Spline
5.1. Rational Bézier curve¶
The rational Bézier curve is one of the many possible generalization of the Bézier curves.
5.1.1. Definition¶
Let consider
the \(\{\textbf{b}_i\}_{i=0}^n\) control points, and
the \(\{w_i\}_{i=0}^n\) non-negative weights (\(\sum_{i=0}^n w_i \neq 0\)).
We can define the degree \(n\) rational Bézier curve in the following form:
5.1.2. Properties of the curve¶
When we allow only non-negative weights, the curve remains in the convex hull of the control points.
Proof
Let consider the base functions in the expression of the curve:
We can see that this expression is non-negative.
When we summarize by the indices \(i \in [0, n]\), the denominator remains the same, and will be match the numerator. It means that, it results 1.
Therefore, it is guaranteed that it is a convex combination. Therefore, the curve remains in the convex hull of the control points. \(\square\)
Further properties:
The curve remains the same, when we consider the control points (and its corresponding weights) in the opposite order.
The curve is globally modifiable.
It interpolates at the endpoints.
The tangent line at the endpoint can be determined by the endpoint and the adjacent control point.
Any line (plane or hyperplane in higher dimensions) intersects the curve at most as many points as the number of intersection points with the control polygon. (variation diminishing property)
The curve is invariant to the affine transformation of the parameters.
The curve is closed under the projective transformation of the control points.
5.1.3. Description of conics¶
A segment of a cone can be results the following shapes:
parabola,
ellipse,
hyperbola.
The second degree Bézier curve results a parabola, therefore it is given from the original construction.
Let consider a degree 2 Bézier curve, where \(w_0 = 1, w_2 = 1\)! We can obtain the previously mentioned curve by the proper selection of the weight \(w_1\):
\(0 < w_1 < 1\) results ellipse,
\(w_1 = 1\) results parabola,
\(w_1 > 1\) results hyperbola.
5.1.4. Rational de Casteljau-algorithm¶
A modified version of the de Casteljau algorithm is able to calculate the points of a rational Bézier curve. We have to calculate the weights for proportional subdivision in the function of the parameter \(t\). In the step \(r\) it means:
We obtain the auxiliary points as
where
furthermore, in the step \(r = 0\):
We get the point of the curve as \(\textbf{b}(t) = \textbf{b}_0^n(t)\) (where \(t \in [0, 1]\)).
Note
This algorithm is also can split the curve.
5.2. Rational B-spline curve¶
We call the rational B-spline curves as NURBS (Non-Uniform Rational B-Spline). This name is mathematically not correct, because it does not exclude the uniform case. The name not necessarily uniform could be better, because the weights can be the same.
5.2.1. Definition¶
Let denote
\(N_i^k\) the \(i\)-th degree \((k-1)\) normalized B-spline base function,
let given the control points (or de Boor points) \(\{\textbf{d}_i\}_{i=0}^n\),
the knot values \(\{u_i\}_{i=0}^{n+k}\), and
the \(\{w_i\}_{i=0}^n\) non-negative weights (which are not identically zero).
We define the order \(k\) (or in other words degree \((k-1)\)) rational B-spline curve as the following:
5.2.2. Properties¶
Fortunately, most of the properties of the B-spline curves are also valid in the case of rational B-spline curves.
When the multiplicity at the endpoint is \((k - 1)\), then the curve is interpolative at the endpoints.
In the previous case, it also holds that the line determined by the endpoint and the adjacent point is the tangent line.
The curve is locally modifiable.
An arc of the curve \(\textbf{s}(u)\), \(u \in [u_i, u_{i+1})\) (where \(i = k - 1, k, \ldots, n\)) is in the convex hull of the control points \(\{\textbf{d}_j\}_{j=i-k+1}^i\). It also means that, the curve will be in the union of these convex hulls.
Variation diminishing property: Any line (plane or hyperplane in higher dimensions) intersects the curve at most as many points as the number of intersection points with the control polygon.
When the multiplicity is \((k - 1)\) at the endpoints, and there is no further inner control point, we obtain a Bézier curve.
5.2.3. Rational de Boor algorithm¶
Similarly to the de Casteljau algorithm, there is a rational version of the de Boor algoritm.
5.3. Application areas¶
5.3.1. Scalable vector graphics¶
SVG standard, file format
Its basic elements:
5.3.1.1. The Path command¶
Available operations:
M
: Move ToL
: Line ToH
: HorizontalV
: VerticalZ
: Close Path
Their lower case counterparts use relative coordinates regarding to the last reached point.
5.3.1.2. Curve command¶
5.3.2. HTML5 Canvas¶
\(\rhd\) Let review the opportunities for drawing Bézier curves in various programming languages, libraries and frameworks!
5.3.3. PostScript¶
5.3.4. TikZ¶
5.3.5. WaveFront OBJ format¶
5.3.6. Vector graphics editors¶
Inkscape: https://inkscape.org/
CorelDRAW: https://www.coreldraw.com/en/
Note
We can find functionality for drawing Bézier curves in raster editors also, for example the path tool of GIMP.
5.3.7. Design of font faces¶
Font systems:
Apple, font design:
5.4. Theoretical questions¶
How can we define the rational Bézier curves?
What is the advantage of using rational Bézier curves related to the Bézier curves? What are the inherited properties?
How can we describe conics by using rational Bézier curves?
How can we define the rational B-spline curve?
What are the properties of the rational B-spline curves?
5.5. Programming exercises¶
5.5.1. Rational Bézier curve¶
Let implement the calculation and visualization of the curve!
Let make possible to modify the weights and knot values interactively!
Let estimate the length of the curve!
5.5.2. Rational B-spline curve¶
Let implement the calculation and visualization of the curve!
Let make possible to modify the weights and knot values interactively!
Let estimate the length of the curve!
5.6. Further exercises¶
Let examine the accurracy of the approximation of rational Bézier curves by using (uniform) Bézier curves!
Let examine the accurracy of the approximation of rational B-spline curves by using (uniform) B-spline curves!
Let given the set of points and we would like to fit a curve. (Let assume that, the curve is unable to pass over all off the sample points.) Let solve the curve fitting as an optimization problem, by finding the appropriate control points, knot values and weights!