Presentation is loading. Please wait.

Presentation is loading. Please wait.

March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics B-Spline curves (Chapter 8) Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem.

Similar presentations


Presentation on theme: "March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics B-Spline curves (Chapter 8) Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem."— Presentation transcript:

1 March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics B-Spline curves (Chapter 8) Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem March 1, 2009

2 Dr. Muhammed Al-Mulhem2 Better Blending Functions Bezier curves do not provide enough flexibility in curve design. A Bezier curve based on L+1 control points is a combination of L-degree polynomials. High degree polynomials are expensive to compute, and are vulnerable to numerical round-off errors. We want the designer to be free to use as many control points as desired, even 40 or more. Bezier curves do not provide enough flexibility in curve design. A Bezier curve based on L+1 control points is a combination of L-degree polynomials. High degree polynomials are expensive to compute, and are vulnerable to numerical round-off errors. We want the designer to be free to use as many control points as desired, even 40 or more.

3 March 1, 2009Dr. Muhammed Al-Mulhem3 Better Blending Functions Bezier curves do not offer enough local control of the curve shape. The figure shows five control points used to fashion a Bezier curve (solid line), which deviates somewhat from the desired curve (dashed line) near t = 1. Bezier curves do not offer enough local control of the curve shape. The figure shows five control points used to fashion a Bezier curve (solid line), which deviates somewhat from the desired curve (dashed line) near t = 1.

4 March 1, 2009Dr. Muhammed Al-Mulhem4 Better Blending Functions To correct this, the user would move P 2 and P 3 up somewhat to force the Bezier curve closer to the desired curve.To correct this, the user would move P 2 and P 3 up somewhat to force the Bezier curve closer to the desired curve. But this also affects the shape of the first half of the curve, forcing it away somewhat from the desired version.But this also affects the shape of the first half of the curve, forcing it away somewhat from the desired version. To correct this, the user would move P 2 and P 3 up somewhat to force the Bezier curve closer to the desired curve.To correct this, the user would move P 2 and P 3 up somewhat to force the Bezier curve closer to the desired curve. But this also affects the shape of the first half of the curve, forcing it away somewhat from the desired version.But this also affects the shape of the first half of the curve, forcing it away somewhat from the desired version.

5 March 1, 2009Dr. Muhammed Al-Mulhem5 Better Blending Functions A change to any control point alters the entire curve. This arises from the nature of Bernstein polynomials: each is “active” (non-zero) over the entire interval [0, 1]. The interval over which a function is nonzero is often called its support. Because every Bernstein polynomial has support over the entire interval [0, 1], and the curve is a blend of these functions, each control point has an effect on the curve at all t-values between 0 and 1. Therefore, adjusting any control point affects the shape of the curve everywhere, with no local control. A change to any control point alters the entire curve. This arises from the nature of Bernstein polynomials: each is “active” (non-zero) over the entire interval [0, 1]. The interval over which a function is nonzero is often called its support. Because every Bernstein polynomial has support over the entire interval [0, 1], and the curve is a blend of these functions, each control point has an effect on the curve at all t-values between 0 and 1. Therefore, adjusting any control point affects the shape of the curve everywhere, with no local control.

6 March 1, 2009Dr. Muhammed Al-Mulhem6 Better Blending Functions The four cubic Bézier blending functions:

7 March 1, 2009Dr. Muhammed Al-Mulhem7 Better Blending Functions Contrast the set of blending functions at right. Six blending functions, R 0 (t), R 1 (t),..., R 5 (t) are shown, each having support that is only a part of the interval [0, 1]. Contrast the set of blending functions at right. Six blending functions, R 0 (t), R 1 (t),..., R 5 (t) are shown, each having support that is only a part of the interval [0, 1].

8 March 1, 2009Dr. Muhammed Al-Mulhem8 Better Blending Functions For instance, the support of R 0 (t) is [0,.25] and that of R 3 (t) is [.25, 1.0]. At any value of t, no more than three of the blending functions are active. For instance, the support of R 0 (t) is [0,.25] and that of R 3 (t) is [.25, 1.0]. At any value of t, no more than three of the blending functions are active.

9 March 1, 2009Dr. Muhammed Al-Mulhem9 Better Blending Functions We use the blending functions to build a curve, V(t), based on six given control points, P 0, P 1,..., P 5. We use the same kind of parametric form as for Bezier curves: We use the blending functions to build a curve, V(t), based on six given control points, P 0, P 1,..., P 5. We use the same kind of parametric form as for Bezier curves:

10 March 1, 2009Dr. Muhammed Al-Mulhem10 Better Blending Functions At each t the position V(t) depends on no more than three control points. For all t in [0.75, 1.0] only the points P 3, P 4, and P 5 control the shape of the curve. If P 4 is moved to P’ 4, only the dashed portion of the curve will change. These blending functions give some local control to the control points. At each t the position V(t) depends on no more than three control points. For all t in [0.75, 1.0] only the points P 3, P 4, and P 5 control the shape of the curve. If P 4 is moved to P’ 4, only the dashed portion of the curve will change. These blending functions give some local control to the control points.

11 March 1, 2009Dr. Muhammed Al-Mulhem11 Wish List for Blending Functions The blending functions should: be easy to compute and numerically stable; sum to one at every t in [a,b]; have small support to offer local control; interpolate certain control points, chosen by the designer; be smooth enough. The blending functions should: be easy to compute and numerically stable; sum to one at every t in [a,b]; have small support to offer local control; interpolate certain control points, chosen by the designer; be smooth enough.

12 March 1, 2009Dr. Muhammed Al-Mulhem12 The functions should be easy to compute and numerically stable. For rapid curve generation we want the blending functions to be computationally simple. We also want them to be minimally affected by numerical round-off error. Consequently, we choose polynomials for the blending functions; the degree of the polynomials should be fairly small. – –Other kinds of functions, such as sines and cosines, would be too expensive to use. For rapid curve generation we want the blending functions to be computationally simple. We also want them to be minimally affected by numerical round-off error. Consequently, we choose polynomials for the blending functions; the degree of the polynomials should be fairly small. – –Other kinds of functions, such as sines and cosines, would be too expensive to use.

13 March 1, 2009Dr. Muhammed Al-Mulhem13 The functions must sum to one at every t in [a, b]. V(t) is a weighted sum of points at each t, and this makes sense only if it is an affine sum of points at every t in [a, b]. (Otherwise it is not a point.) Thus we insist that:

14 March 1, 2009Dr. Muhammed Al-Mulhem14 The functions should have small support for local control. To achieve local control we want each blending function to be concentrated in t, having support over only a small portion of the interval [a, b].

15 March 1, 2009Dr. Muhammed Al-Mulhem15 The functions should interpolate certain control points. The designer may want V(t) to pass through some of the control points, but only be attracted towards others. We will need to provide a mechanism that adjusts the blending functions so that certain control points are interpolated. The designer may want V(t) to pass through some of the control points, but only be attracted towards others. We will need to provide a mechanism that adjusts the blending functions so that certain control points are interpolated.

16 March 1, 2009Dr. Muhammed Al-Mulhem16 The functions should have sufficient smoothness. The designer normally wants V(t) to be a smooth curve for any set of control points. Typically V(t) should be at least 1-smooth, or even 2-smooth, to produce shapes of the desired smoothness. The smoothness of V(t) depends on the smoothness of the blending functions. – –Specifically, if every blending function is 1-smooth in [a, b], then V(t) will also be 1-smooth in [a, b]. The designer normally wants V(t) to be a smooth curve for any set of control points. Typically V(t) should be at least 1-smooth, or even 2-smooth, to produce shapes of the desired smoothness. The smoothness of V(t) depends on the smoothness of the blending functions. – –Specifically, if every blending function is 1-smooth in [a, b], then V(t) will also be 1-smooth in [a, b].

17 March 1, 2009Dr. Muhammed Al-Mulhem17 The functions should have sufficient smoothness. (2) The derivative varies continuously from 0 at t = c, where the function starts. But the derivative at d is discontinuous, jumping abruptly from A to 0. A curve using this blending function would not be 1-smooth at t = d. Thus it is desirable for blending functions to be smooth internally, and also to start and end with derivatives of 0. The derivative varies continuously from 0 at t = c, where the function starts. But the derivative at d is discontinuous, jumping abruptly from A to 0. A curve using this blending function would not be 1-smooth at t = d. Thus it is desirable for blending functions to be smooth internally, and also to start and end with derivatives of 0.

18 March 1, 2009Dr. Muhammed Al-Mulhem18 The functions should have sufficient smoothness. (3) Some R k start and stop with zero derivatives; others do not. The shapes that begin and end inside [0, 1] do so with zero derivatives, so the curve V(t) will be 1-smooth inside (0,1). The derivatives may be discontinuous at t = 0 or t = 1 because we never use values of t beyond 0 or 1. Some R k start and stop with zero derivatives; others do not. The shapes that begin and end inside [0, 1] do so with zero derivatives, so the curve V(t) will be 1-smooth inside (0,1). The derivatives may be discontinuous at t = 0 or t = 1 because we never use values of t beyond 0 or 1.

19 March 1, 2009Dr. Muhammed Al-Mulhem19 Piecewise Polynomial Curves and Splines There is no single cubic polynomial which can serve as a blending function. Instead, we piece together several low-degree polynomials. The curves are defined by different polynomials in different t-intervals and are called piecewise polynomials. There is no single cubic polynomial which can serve as a blending function. Instead, we piece together several low-degree polynomials. The curves are defined by different polynomials in different t-intervals and are called piecewise polynomials.

20 March 1, 2009Dr. Muhammed Al-Mulhem20 Piecewise Polynomial Curves and Splines (2) The example shape, g(t), helps establish some nomenclature. g(t) consists of three polynomial segments, defined as The example shape, g(t), helps establish some nomenclature. g(t) consists of three polynomial segments, defined as

21 March 1, 2009Dr. Muhammed Al-Mulhem21 Piecewise Polynomial Curves and Splines (3) The support of g(t) is [0, 3]. – –a(t) is defined on the span [0, 1], b(t) on the span [1, 2], and c(t) on the span [2, 3]. The points where a pair of segments meet are called joints. The values of t at the joints are called knots. – –There are four knots in this example: 0, 1, 2, and 3. The support of g(t) is [0, 3]. – –a(t) is defined on the span [0, 1], b(t) on the span [1, 2], and c(t) on the span [2, 3]. The points where a pair of segments meet are called joints. The values of t at the joints are called knots. – –There are four knots in this example: 0, 1, 2, and 3.

22 March 1, 2009Dr. Muhammed Al-Mulhem22 Piecewise Polynomial Curves and Splines (4) g(t) is continuous over its support; because it is built from polynomials, it is certainly continuous inside each span, and a(1) = b(1) = 1/2, and b(2) = c(2) = 1/2. The derivative of g(t) is continuous everywhere: g(t) is 1-smooth in [0, 3]. – –The derivative is continuous inside each span and a’(1) =b’(1) =1, b’(2) = c’(2) = -1. g(t) is continuous over its support; because it is built from polynomials, it is certainly continuous inside each span, and a(1) = b(1) = 1/2, and b(2) = c(2) = 1/2. The derivative of g(t) is continuous everywhere: g(t) is 1-smooth in [0, 3]. – –The derivative is continuous inside each span and a’(1) =b’(1) =1, b’(2) = c’(2) = -1.

23 March 1, 2009Dr. Muhammed Al-Mulhem23 Splines The shape g(t) here is an example of a spline function, a piecewise polynomial function that is “smooth enough”. Definition of a Spline Function: An M th -degree spline function is a piecewise polynomial of degree M that is (M-1)-smooth at each knot. – –The example g(t) is a quadratic spline: It is a piecewise polynomial of degree 2 and has a continuous first derivative everywhere. The shape g(t) here is an example of a spline function, a piecewise polynomial function that is “smooth enough”. Definition of a Spline Function: An M th -degree spline function is a piecewise polynomial of degree M that is (M-1)-smooth at each knot. – –The example g(t) is a quadratic spline: It is a piecewise polynomial of degree 2 and has a continuous first derivative everywhere.

24 March 1, 2009Dr. Muhammed Al-Mulhem24 Making Blending Functions from Splines We use translated versions of g(t), where each blending function g k (t) is formed by translating the basic shape g(t) by a certain amount. The figure shows seven blending functions g 0 (t),..,g 6 (t) formed by translating g(t) by integer amounts: g k (t) = g(t+k) for k = 0, 1, 2, … We use translated versions of g(t), where each blending function g k (t) is formed by translating the basic shape g(t) by a certain amount. The figure shows seven blending functions g 0 (t),..,g 6 (t) formed by translating g(t) by integer amounts: g k (t) = g(t+k) for k = 0, 1, 2, …

25 March 1, 2009Dr. Muhammed Al-Mulhem25 Making Blending Functions from Splines (2) Since the knots of the various versions of g(t) occur at integers, this is equivalent to translating; the knots of one curve then line up with knots of the next curve. These translated versions will form a legitimate set of blending functions only if they add up exactly to 1 at every t. But they do for all t in [2, 7]. Since the knots of the various versions of g(t) occur at integers, this is equivalent to translating; the knots of one curve then line up with knots of the next curve. These translated versions will form a legitimate set of blending functions only if they add up exactly to 1 at every t. But they do for all t in [2, 7].

26 March 1, 2009Dr. Muhammed Al-Mulhem26 Making Blending Functions from Splines (3) The designer chooses 7 control points and generates the curve from Only values of t between 2 and 7 can be used. In that range, exactly three of the blending functions are active at any value of t, so there is good local control of the curve’s shape. In addition, at times t = 2, 3,.., and 7 only two of the functions are active and they both have value 0.5. Therefore, at these t-values V(t) will lie at the midpoint of the line between two of the control points. The designer chooses 7 control points and generates the curve from Only values of t between 2 and 7 can be used. In that range, exactly three of the blending functions are active at any value of t, so there is good local control of the curve’s shape. In addition, at times t = 2, 3,.., and 7 only two of the functions are active and they both have value 0.5. Therefore, at these t-values V(t) will lie at the midpoint of the line between two of the control points.

27 March 1, 2009Dr. Muhammed Al-Mulhem27 Making Blending Functions from Splines: Example (4)

28 March 1, 2009Dr. Muhammed Al-Mulhem28 Properties of the Curve The designer has some local control of the curve shape, because the interval of support for each blending function is limited to length 3. The designer knows that the curve must pass through midpoints of the control polygon edges. So the algorithm has some intuitive geometric properties. Because each blending function is 1-smooth, the whole curve is 1-smooth. No control points on the curve are interpolated. All polynomials are of degree two, so they are fast and stable to compute. The degree of the polynomials does not depend on the number of control points. The technique works for any number of control points. The designer has some local control of the curve shape, because the interval of support for each blending function is limited to length 3. The designer knows that the curve must pass through midpoints of the control polygon edges. So the algorithm has some intuitive geometric properties. Because each blending function is 1-smooth, the whole curve is 1-smooth. No control points on the curve are interpolated. All polynomials are of degree two, so they are fast and stable to compute. The degree of the polynomials does not depend on the number of control points. The technique works for any number of control points.

29 March 1, 2009Dr. Muhammed Al-Mulhem29 More General Blending Functions We need more control of the curve shape: it must bend more and be smoother than just 1-smooth. This suggests moving to cubic polynomials. We also want the designer to be able to specify which control points are interpolated. And we want a single algorithm that would encompass all of the design techniques described above — including Bezier curves. So we want to develop more general families of blending functions that meet all the properties discussed in the earlier wish list. We need more control of the curve shape: it must bend more and be smoother than just 1-smooth. This suggests moving to cubic polynomials. We also want the designer to be able to specify which control points are interpolated. And we want a single algorithm that would encompass all of the design techniques described above — including Bezier curves. So we want to develop more general families of blending functions that meet all the properties discussed in the earlier wish list.

30 March 1, 2009Dr. Muhammed Al-Mulhem30 More General Blending Functions (2) We continue to use the same parametric form based on L+1 control points and L+1 blending functions R 0 (t),..., R L (t). We also continue to use piecewise polynomials for the blending functions, but now they are defined on a more general sequence of knots, called the knot vector, T = [t 0, t 1, t 2, …]. Some knots might have the same value but are still given distinct names. We continue to use the same parametric form based on L+1 control points and L+1 blending functions R 0 (t),..., R L (t). We also continue to use piecewise polynomials for the blending functions, but now they are defined on a more general sequence of knots, called the knot vector, T = [t 0, t 1, t 2, …]. Some knots might have the same value but are still given distinct names.

31 March 1, 2009Dr. Muhammed Al-Mulhem31 More General Blending Functions (3) Each blending function R k (t) is a piecewise polynomial that is zero up to time t k, is non-zero over several spans in the knot vector, and then returns to zero again. We insist further that each R k (t) be a spline function, so that it ensures a certain level of smoothness at all t in its support. Each blending function R k (t) is a piecewise polynomial that is zero up to time t k, is non-zero over several spans in the knot vector, and then returns to zero again. We insist further that each R k (t) be a spline function, so that it ensures a certain level of smoothness at all t in its support.

32 March 1, 2009Dr. Muhammed Al-Mulhem32 More General Blending Functions (4) Given a knot vector, is there some family of blending functions that can be used to generate every possible spline curve that can be defined on that knot vector? Such a family is called a basis for the splines, meaning that any spline curve whatsoever can be matched by the sum by choosing the proper control points. Given a knot vector, is there some family of blending functions that can be used to generate every possible spline curve that can be defined on that knot vector? Such a family is called a basis for the splines, meaning that any spline curve whatsoever can be matched by the sum by choosing the proper control points.

33 March 1, 2009Dr. Muhammed Al-Mulhem33 More General Blending Functions (5) There are many such families, but there is one basis in particular whose blending functions have the smallest support and therefore offer the greatest local control. These are the B-splines, the ‘B’ derived from the word basis. There are many such families, but there is one basis in particular whose blending functions have the smallest support and therefore offer the greatest local control. These are the B-splines, the ‘B’ derived from the word basis.

34 March 1, 2009Dr. Muhammed Al-Mulhem34 B-Spline Basis Functions There is a single recursive formula that defines all the B-spline functions of any order. It is easy to implement in a program and is numerically well behaved. Some other methods are more computationally efficient. There is a single recursive formula that defines all the B-spline functions of any order. It is easy to implement in a program and is numerically well behaved. Some other methods are more computationally efficient.

35 March 1, 2009Dr. Muhammed Al-Mulhem35 B-Spline Basis Functions (2) Each B-spline function is based on polynomials of a certain order, m. – –If m = 3, the polynomials will be of order 3 and thus of degree 2, and so they will be quadratic B-splines. – –If the order is m = 4, the underlying polynomials will be of degree 3, or cubic. These are the two most important cases, although the formulation allows us to construct B-splines of any order. Each B-spline function is based on polynomials of a certain order, m. – –If m = 3, the polynomials will be of order 3 and thus of degree 2, and so they will be quadratic B-splines. – –If the order is m = 4, the underlying polynomials will be of degree 3, or cubic. These are the two most important cases, although the formulation allows us to construct B-splines of any order.

36 March 1, 2009Dr. Muhammed Al-Mulhem36 B-Spline Basis Functions (3) It is useful to make the order of a B-spline function explicit in the notation, and so we denote the k-th B-spline blending function of order m by N k,m (t).

37 March 1, 2009Dr. Muhammed Al-Mulhem37 B-Spline Basis Functions (4) Summarizing the ingredients, we have – –a knot vector T = (t 0, t 1, t 2... ) – –(L+1) control points P k – –the order m of the B-spline functions The B-spline function for k = 0, 1, …, L is given by Summarizing the ingredients, we have – –a knot vector T = (t 0, t 1, t 2... ) – –(L+1) control points P k – –the order m of the B-spline functions The B-spline function for k = 0, 1, …, L is given by

38 March 1, 2009Dr. Muhammed Al-Mulhem38 B-Spline Basis Functions (5) To get things started, the first-order function must be defined. It is simply the constant function 1 within its span: To get things started, the first-order function must be defined. It is simply the constant function 1 within its span:

39 March 1, 2009Dr. Muhammed Al-Mulhem39 B-Spline Basis Functions (6) This set of functions automatically sums to one at every t, so it is legitimate to use them in forming combinations of points. Code to calculate the B-spline basis functions recursively is given in your book. This set of functions automatically sums to one at every t, so it is legitimate to use them in forming combinations of points. Code to calculate the B-spline basis functions recursively is given in your book.

40 March 1, 2009Dr. Muhammed Al-Mulhem40 Using Multiple Knots in the Knot Vector Up to this point we have used only B-splines based on equispaced knots. By varying the spacing between knots, the curve designer acquires much greater control of the shape of the final curve. A central question is what happens to the shapes of the blending functions when two knots are set very close to one another. Up to this point we have used only B-splines based on equispaced knots. By varying the spacing between knots, the curve designer acquires much greater control of the shape of the final curve. A central question is what happens to the shapes of the blending functions when two knots are set very close to one another.

41 March 1, 2009Dr. Muhammed Al-Mulhem41 Using Multiple Knots in the Knot Vector (2) The figure shows the situation when the knot vector is T = (0, 1, 2, 3, 3+ ε, 4+ ε,... ), where ε is a small positive number.

42 March 1, 2009Dr. Muhammed Al-Mulhem42 Using Multiple Knots in the Knot Vector (3) The piece of each piecewise polynomial lying in the interval [3, 3+ ε] has become squeezed into a very narrow span. The blending functions are not translations of one another. If ε = 0, this span will vanish altogether, and a multiple knot will occur at t = 3. This knot is said to have a “multiplicity of 2.” The piece of each piecewise polynomial lying in the interval [3, 3+ ε] has become squeezed into a very narrow span. The blending functions are not translations of one another. If ε = 0, this span will vanish altogether, and a multiple knot will occur at t = 3. This knot is said to have a “multiplicity of 2.”

43 March 1, 2009Dr. Muhammed Al-Mulhem43 Using Multiple Knots in the Knot Vector (4) Two of the linear B-splines are discontinuous, and the quadratic shapes have a discontinuous derivative at t = 3. In general, an i-smooth curve is reduced to an (i-1)-smooth curve at the multiple knot value. The cubic B-spline curves are 1-smooth everywhere, but not 2-smooth at t = 3. But if quadratic B-splines are used, the curve will interpolate control point P 2 because the blending function N 2,3 (t) reaches value 1 at t = 3 and all the other blending functions are zero there. In general, when t approaches a knot of multiplicity greater than one, there is a stronger attraction to the governing control point. Two of the linear B-splines are discontinuous, and the quadratic shapes have a discontinuous derivative at t = 3. In general, an i-smooth curve is reduced to an (i-1)-smooth curve at the multiple knot value. The cubic B-spline curves are 1-smooth everywhere, but not 2-smooth at t = 3. But if quadratic B-splines are used, the curve will interpolate control point P 2 because the blending function N 2,3 (t) reaches value 1 at t = 3 and all the other blending functions are zero there. In general, when t approaches a knot of multiplicity greater than one, there is a stronger attraction to the governing control point.

44 March 1, 2009Dr. Muhammed Al-Mulhem44 Using Multiple Knots in the Knot Vector (5) Quadratic splines become discontinuous near a knot of multiplicity 3. Cubic splines exhibit a discontinuous derivative near a knot of multiplicity 3, but they also interpolate one of the control points. By adjusting the multiplicity of each knot, the designer can change the shape of the curve in a predictable fashion. Neither the equation nor the code need be altered when the knot vector contains multiple knots. As we mentioned, some of the denominators become zero, but the code automatically handles this situation, and no adjustments need be made. Quadratic splines become discontinuous near a knot of multiplicity 3. Cubic splines exhibit a discontinuous derivative near a knot of multiplicity 3, but they also interpolate one of the control points. By adjusting the multiplicity of each knot, the designer can change the shape of the curve in a predictable fashion. Neither the equation nor the code need be altered when the knot vector contains multiple knots. As we mentioned, some of the denominators become zero, but the code automatically handles this situation, and no adjustments need be made.

45 March 1, 2009Dr. Muhammed Al-Mulhem45 Standard Knot Vector The standard knot vector for a B-spline of order m begins and ends with a knot of multiplicity m and uses unit spacing for the remaining knots. We start with an example and then see how it arises. Suppose there are eight control points and we want to use cubic (m = 4) B-splines. The standard knot vector turns out to be T = (0, 0, 0, 0, 1, 2, 3, 4, 5, 5, 5, 5) The standard knot vector for a B-spline of order m begins and ends with a knot of multiplicity m and uses unit spacing for the remaining knots. We start with an example and then see how it arises. Suppose there are eight control points and we want to use cubic (m = 4) B-splines. The standard knot vector turns out to be T = (0, 0, 0, 0, 1, 2, 3, 4, 5, 5, 5, 5)

46 March 1, 2009Dr. Muhammed Al-Mulhem46 Standard Knot Vector (2) Blending functions N 0,4 (t) and N 7,4 (t) are discontinuous and have a support of one unit span. Only N 3,4 (t) and N 4,4 (t) have the usual span of four units. The remaining blending functions have two or three unit spans, and their shapes become more distorted as they approach the first and last knots. Blending functions N 0,4 (t) and N 7,4 (t) are discontinuous and have a support of one unit span. Only N 3,4 (t) and N 4,4 (t) have the usual span of four units. The remaining blending functions have two or three unit spans, and their shapes become more distorted as they approach the first and last knots.

47 March 1, 2009Dr. Muhammed Al-Mulhem47 Standard Knot Vector (3) The standard knot vector always ensures interpolation of the first and last control points. The initial direction of the B- spline curve at t = 0 is along the first segment of the control polygon, and similarly for the final direction. Note that a B-spline curve can cross itself when the control polygon does. The standard knot vector always ensures interpolation of the first and last control points. The initial direction of the B- spline curve at t = 0 is along the first segment of the control polygon, and similarly for the final direction. Note that a B-spline curve can cross itself when the control polygon does.

48 March 1, 2009Dr. Muhammed Al-Mulhem48 Standard Knot Vector (4) The standard knot vector for (L+1) control points and order-m B-splines is described as follows There are L+m+1 knots, denoted as t 0,...,t L+m. The first m knots, t 0,..., t m - 1, all share the value 0. (The first m blending functions start at t = 0.) Knots t m,..., t L increase in increments of 1, from value 1 through value L - m+1. (The final blending function, N L,m (t), begins at t L = L - m + 1 and has a support of width 1.) The final m knots, t L+1,..., t L+m, all equal L - m + 2. The standard knot vector for (L+1) control points and order-m B-splines is described as follows There are L+m+1 knots, denoted as t 0,...,t L+m. The first m knots, t 0,..., t m - 1, all share the value 0. (The first m blending functions start at t = 0.) Knots t m,..., t L increase in increments of 1, from value 1 through value L - m+1. (The final blending function, N L,m (t), begins at t L = L - m + 1 and has a support of width 1.) The final m knots, t L+1,..., t L+m, all equal L - m + 2.

49 March 1, 2009Dr. Muhammed Al-Mulhem49 Code for the Standard Knot Vector void buildKnots (int m, int L, double knot[ ]) { // Build the standard knot vector for L+1 control points // and B-splines of order m int i; if (L < (m - 1)) return; // too few control points for (i = 0; i <= L + m; i++) if (i < m) knot[i] = 0.0; else if (i <= L) knot[i] = i - m + 1; // i is at least m here else knot[i] = L - m + 2; // i exceeds L here } void buildKnots (int m, int L, double knot[ ]) { // Build the standard knot vector for L+1 control points // and B-splines of order m int i; if (L < (m - 1)) return; // too few control points for (i = 0; i <= L + m; i++) if (i < m) knot[i] = 0.0; else if (i <= L) knot[i] = i - m + 1; // i is at least m here else knot[i] = L - m + 2; // i exceeds L here }

50 March 1, 2009Dr. Muhammed Al-Mulhem50 B-splines and Bezier Curves Bezier curves are a special case of B-splines. This is so because the B-spline blending functions defined on the standard knot vector are in fact Bernstein polynomials when m = L + 1. That is, N k,L+1 (t) = B k L (t) for k = 0,..., L. – –Note that by convention the upper parameter of B() is degree, while the second parameter of N() is order. Bezier curves are a special case of B-splines. This is so because the B-spline blending functions defined on the standard knot vector are in fact Bernstein polynomials when m = L + 1. That is, N k,L+1 (t) = B k L (t) for k = 0,..., L. – –Note that by convention the upper parameter of B() is degree, while the second parameter of N() is order.

51 March 1, 2009Dr. Muhammed Al-Mulhem51 B-splines and Bezier Curves (2) B-spline curves give local control of the shape. When the order of the B-spline polynomials is increased by 1, the support of each B-spline blending function extends one span further, reducing the amount of local control. When m reaches the bound of L+1, the Bezier case is obtained, and local control is at a minimum. B-spline curves give local control of the shape. When the order of the B-spline polynomials is increased by 1, the support of each B-spline blending function extends one span further, reducing the amount of local control. When m reaches the bound of L+1, the Bezier case is obtained, and local control is at a minimum.

52 March 1, 2009Dr. Muhammed Al-Mulhem52 Useful Properties of B-splines for Design 1. 1.The m-th-order B-spline functions are piecewise polynomials of order m. They are (m-2)-smooth splines: They exhibit (m - 2) orders of continuous derivatives at every point in their support. They form a basis for any spline of the same order defined on the same knots; i.e., any spline can be represented as a linear combination of B- splines. Of all spline bases, the B-splines are the most concentrated, having the shortest supports.

53 March 1, 2009Dr. Muhammed Al-Mulhem53 Useful Properties of B-splines for Design (2) 2. 2.The B-spline blending function, N k,m (t), begins at t k and ends at t k+m. Its support is [t k, t k+m ]. The support of the family of functions, N k,m (t), for k = 0,..., L is the interval [t 0, t m+L ]. 3. 3.A closed B-spline curve based on L + 1 control points may be obtained (look at your book pages 447-448). 2. 2.The B-spline blending function, N k,m (t), begins at t k and ends at t k+m. Its support is [t k, t k+m ]. The support of the family of functions, N k,m (t), for k = 0,..., L is the interval [t 0, t m+L ]. 3. 3.A closed B-spline curve based on L + 1 control points may be obtained (look at your book pages 447-448).

54 March 1, 2009Dr. Muhammed Al-Mulhem54 Useful Properties of B-splines for Design (3) 4. 4.If the standard knot vector is used, the B-spline curve will interpolate the first and last control points. Its initial and final directions are along the first and last edges of the control polygon, respectively. 5. 5.Each B-spline function, N k,m (t), is nonnegative for every t, and the family of such functions sums to 1. 4. 4.If the standard knot vector is used, the B-spline curve will interpolate the first and last control points. Its initial and final directions are along the first and last edges of the control polygon, respectively. 5. 5.Each B-spline function, N k,m (t), is nonnegative for every t, and the family of such functions sums to 1.

55 March 1, 2009Dr. Muhammed Al-Mulhem55 Useful Properties of B-splines for Design (4) 6. 6.Curves based on B-splines are affine invariant (transformation invariant). To transform a B-spline curve, simply transform each control point, and generate the new curve based on the transformed control points. 7. 7.A B-spline curve is a convex combination of its control points and so lies in their convex hull. A stronger statement is possible: At any t only m B-spline functions are active (nonzero). Thus at each t the curve must lie in the convex hull of at most m consecutive active control points. 6. 6.Curves based on B-splines are affine invariant (transformation invariant). To transform a B-spline curve, simply transform each control point, and generate the new curve based on the transformed control points. 7. 7.A B-spline curve is a convex combination of its control points and so lies in their convex hull. A stronger statement is possible: At any t only m B-spline functions are active (nonzero). Thus at each t the curve must lie in the convex hull of at most m consecutive active control points.

56 March 1, 2009Dr. Muhammed Al-Mulhem56 Useful Properties of B-splines for Design (5) The figure shows a quadratic B- spline curve using the standard knot vector. At most three control points are active at each t; the relevant convex hulls are triangles. As t increases, P(t) passes out of each triangle and into the next as each new blending function becomes active. The figure shows a quadratic B- spline curve using the standard knot vector. At most three control points are active at each t; the relevant convex hulls are triangles. As t increases, P(t) passes out of each triangle and into the next as each new blending function becomes active.

57 March 1, 2009Dr. Muhammed Al-Mulhem57 Useful Properties of B-splines for Design (6) 8. 8.B-spline curves exhibit linear precision: If m consecutive control points are collinear, their convex hull will be a straight line, and the curve will be trapped within it. 9. 9.B-spline curves are variation diminishing: A B- spline curve does not pass through any line more times than does its control polygon. 8. 8.B-spline curves exhibit linear precision: If m consecutive control points are collinear, their convex hull will be a straight line, and the curve will be trapped within it. 9. 9.B-spline curves are variation diminishing: A B- spline curve does not pass through any line more times than does its control polygon.

58 March 1, 2009Dr. Muhammed Al-Mulhem58 Using Multiple Control Points With cubic B-spline curves, the curve based on control points A, B, C, D, E, F, and G is normal. When a double point is used at D, (the control polygon is A, B, C, D, D, E, F, G), the curve is pulled toward D. When a triple point is placed at D, making the control polygon A, B, C, D, D, D, E, F, G, the curve must actually interpolate D. With cubic B-spline curves, the curve based on control points A, B, C, D, E, F, and G is normal. When a double point is used at D, (the control polygon is A, B, C, D, D, E, F, G), the curve is pulled toward D. When a triple point is placed at D, making the control polygon A, B, C, D, D, D, E, F, G, the curve must actually interpolate D.


Download ppt "March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics B-Spline curves (Chapter 8) Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem."

Similar presentations


Ads by Google