12 3D Object Representations (Bezier, B-Splines)
T. Raghuveera
Objectives:
- Understand the properties of Bezier curves
- Understand the theory behind B-Splines
Discussion:
Properties of Bezier curves:
From the previous module we have understood how approximating spline curves are drawn. Also Bezier curves were introduced in that module. In this module let’s start our discussion with the properties of Bezier curves. Let’s recollect the equation for cubic Bezier curve as given
∊ 0,1
We can write general Bezier curve equation in for n control points, as
∊ 0,1
Property: 1
The curves touch (interpolate) the first and last control points but approximate all other intermediate points.
When we substitute u=0 the curve touches the first control point P0, and when u=1, the curve touches the last control point P3.
Property: 2
The curves always lie within their convex hull.
This property means that the curves never lie outside the convex shape of the control polyline. This is because the weights associated with each of the control points is in the interval [0,1] for all values of u in the interval [0,1]. As we know from the previous property that, whenever a curve touches a control point, the weight associated with that point is 1, while all other weights remain insignificant.
Property: 3
The blending functions are non-negative, sum to unity for every ‘u’ in the range [0,1]. This property means that for any value of u in the interval [0,1] all the blending
functions sum to unity.
Property: 4
The slope at the beginning of the curve is along the line joining the first two control points and the slope at the end of the curve is along the line joining the last two end points. Assume there are 6 control points from P0 to P5 in the arrangement as shown below, then
P’(0)= –5P0+ 5P1
P’(1)= –5P4+ 5P5
Property: 5
Closed Bezier curves can be generated by specifying the first and last control points at the same position (as shown in the figure above).
As we know from property-1, that the curves touch the first and the last control points, and if we keep both the first and the last control points at the same position the curve becomes closed.
Property: 6
Specifying multiple control points at the same location gives more weight to that position and the curve gets pulled towards them.
This property means that, when we place more than one control point at the same location the weight at the point tends to be more and the curve gets pulled towards that more than that towards other points. As we know that each control point is associated with one blending function, and with the position being the same the weights get added up and thus the weight is more at that position. This property is useful to design curve shapes of our choice.
Property: 7
Complicated curves can be generated by piecing several Bezier sections of lower degree together.
Assume two Bezier curve sections formed by control points, P0 to P2 and P0’ to P3’. Set the initial point of the new curve section as shown below, i.e. P0’= P2. For achieving C1 continuity place the second control point of the new section at P2+ (P 2-P1). This property is useful because, Bezier curves are dependent on the number of control points, and in turn on the degree of the polynomials. The more the number of control points, the higher is the degree of the polynomials.
Property: 8
Bezier curves show affine invariance.
This property states that, Bezier curves are invariant under affine transformations. It can be understood that, if the Bezier curve is to be transformed using affine transformations like Translation, Rotation, Scaling etc., it is as simple as applying these transformations on control points and redrawing the curve at the new position.
Property: 9
Bezier curves do not vary as much as their control polyline does.
This property states that, even though the control polyline varies too much due to random positioning of the control points, the variation in the curve shape is not proportional. This is an interesting property that we tend to ignore, but it signifies the invariance property of the curve even under complex conditions.
Property: 10
If the control points are collinear, Bezier curve reduces to a straight line.
This property states that, if we place the control points along a straight line, Bezier curves seizes to be a curve and becomes a straight line.
Bezier Matrix:
Bezier curve can be represented in matrix form as below.
Recall the discussion from the previous module (Mod-11) on Hermite Interpolation splines, and if we follow similar solution we get
Bezier Surfaces:
If we extend Bezier curves in two different directions using two parameters say u and v, we get Bezier Surfaces.
Drawbacks of Bezier curves:
- They do not offer local control
- The degree of the polynomials is dependent on the number of control points.
Let’s understand each of the drawbacks in detail. The first drawback says that Bezier curves do not offer Local Control. It means that if we try to modify the shape of a small section of the curve without disturbing the remaining part of the curve, it would not be possible. What actually happens is that, the rest of the curve also gets affected as shown below in the figure. As can be observed from the figure below, if we try to alter the shape of the curve between P2 and P4, it also affects the curve shape between P0 and P2. Local control is very important property that determines the freedom of curve design.
The second drawback says that, the degree of the polynomials is directly related to the number of control points as per the relation
Degree=no. of control points -1
This dependency should be broken, because, with the parameter u in the interval [0,1], and the powers of u (degree) raised in proportion to the number of control points, it becomes difficult to manage such large floating point values, which is cumbersome often.
Now we need to look for blending functions that satisfy our requirements as mentioned above. These blending functions are key to curve design, as they contribute to the curve shape and also offer better control. Let’s expand the range of the parameter from [0,1] to [-∞ , +∞] , the parameter is conventionally referred to as ‘ t’ instead of ‘u’. The value of the parameter ‘t’, where two blending functions meet is called a ‘knot’. There can be a set of knot values, called ‘knot vector’ on which we can define a set of blending functions as shown in the figure below.
Thus the requirements for better blending functions are as follows:
- Blending functions must sum to unity for every ‘t’
- They must be lower degree polynomials
- They must offer better local control
- They must be active over a small span of the entire range of the parameter ‘t’.
- The degree of the polynomials should be independent of the number of control points.
Given a set of knot values, there exists an infinite collection of blending functions, that satisfy the above properties, and there is only one such family that offers the best local control and has lower degree polynomials, and this family called the Basis for all Spline curves that can be generated.
B-Spline Curves:
The B-Spline curves are defined as follows: Here B stands for ‘Basis’.
= , where ≤ ≤
t – is the parameter
tk – are the knot values (k from min to max)
Pk – control points
0 to L – L+1 control points / L+1 blending functions
Nk,m (t) – Kth B-spline blending function of order m
m – order of blending functions (one higher than the degree)
m-1 – degree of blending functions
Blending functions Nk,m (t) are derived using Cox-DeBoor recursion formulae as below
It is evident from the above recursive equation for a B-spline blending function, that a kth B-spline blending function of order m is a weighted combination of two B-spline blending functions of order m-1. Thus the above equations are recursive equations and because the minimum possible order is 1, we need to define the first order B-Spline blending functions, and they are defined as follows
A knot vector is a list of parameter values, or knots, that specify the parameter intervals for the individual curves that make up a B-spline.
t0≤ t1 ≤ t2 ≤ ……..ti-1 ≤ tiare i+1 non-decreasing numbers.
We can define a knot vector with spacing between knots that is either uniform or non-uniform or may have some multiple knots. A Knot vector, with uniform spacing between knots is called a “uniform Knot vector”. Spline curves defined on ‘uniform knot vector’ are called Uniform B-Splines. A knot vector, that is non-uniform, allows placing of knots such that two closely spaced knots might be combined to form one knot by nullifying the spacing between them. It results in a knot called multiple knot. The multiplicity of a knot determines how many knots are combined into one. A knot vector that has some knots as multiple knots is called a “standard knot vector”. B-splines curves drawn on standard knot vector are called ‘ Open B-Splines’.
Uniform Periodic B-Splines:
Consider a knot vector that is uniform, T (t0 = 0, t1 =1, t2 = 2, …)
Linear B-Spline blending functions:
Let, m=2, k=0,1,2,…
Let’s derive the blending functions for this case using Cox-DeBoor recurrence relations as given above.
Case (i) for 0 ≤ t ≤ 1
N0,2 (t) = t [because as per the definition, N0,1(t) = 1 (if 0<t≤1), =0 otherwise)]
Case (ii) for 1 ≤ t ≤ 2:
N0,2 (t) = 2-t
1
,
If we draw the shape of N0,2 (t) for t∈ [0,2], it is as shown in the figure below.
If we derive the equations for the second B-spline blending function or order 2, N1,2(t), the derivation is as follows.
Case (i) 0 ≤ t ≤ 1:
N1,2 (t) = 0
Case (ii) 1 ≤ t ≤ 2:
N1,2 (t) = t-1
Case (iii) 2 ≤ t ≤ 3:
N1,2 (t) = 3-t
Thus we can define the second B-Spline blending function of order 2, N1,2(t) as below
1
,
2
If we derive equations for other B-spline blending functions of order 2, they simply are shifted versions of the previous functions and have the same shape. It can be observed that N1, 2 is a shifted version of N0, 2 by 1 unit to the right on the t axis, similarly N2,2 is shifted by 2 units to the right, and so on. We can generalize this by saying that Nk,2 is shifted by k units to the right. It is also that each function spans 2 units. N0,2 has its span between [0,2], N1,2 has its span in the interval [1,3] and so on, as shown in the figure below.
A spline curve drawn using blending function of order 2 will have a shape as shown below. In fact, it’s not a curve, because the degree of the polynomials is 1. Thus the curves are simply straight lines.
Quadratic B-Spline blending functions:
We need to set the following
m=3, k=0,1,2,…
The above equation can be expanded till the order in the terms on the right hand side, reduces to 1. Now substitute in N0,3(t), equations derived earlier for N0,2(t) and N1,2(t)
Case (i) 0 ≤ t ≤ 1:
N0,3 (t) =
Case (ii) 1 ≤ t ≤ 2:
N0,3 (t) = − −
Case (iii) 2 ≤ t ≤ 3:
N0,3 (t) =
Case (iv) 3 ≤ t ≤ 4:
N0,3 (t) = 0
Thus we can define the N0,3 (t) blending function as below
The shape of blending functions Nk,3(t) for k from 0 to n, where n can be any number, is shown as below. It is evident that the shapes are shifted version of the first function N0,3(t). The function N0,3(t) is shifted by 1 unit and has span between [1,4]. The function N2,3(t) is shifted by 2 units to the right and has span between [2,5] and so on. We can conclude in general that a quadratic B-spline blending function Nk,3(t) starts at tk and ends at tk+3. It is easy to derive equations for the other blending functions Nk,3(t) by simply substituting for t, in the equation of N0,3(t), t–k. (For ex: To derive equations for the blending function N1,3(t), substitute in the equations of N0,3(t), (t-1). To derive equations for the blending function N2,3(t), substitute in the equations of N0,3(t), (t-2) and so on.)
Spline curve drawn using the above quadratic blending functions look like the one as shown below.
Summary:
- We have learnt the important properties of Bezier curves
- Understood the drawbacks of Bezier curves
- Learnt the theory behind drawing Linear, Quadratic, B-Spline curves.
************************************************************************************************