Bézier Splines CS 475 / CS 675 Computer Graphics Lecture 14 : Modelling Curves 3 n P t = B i J n,i t with 0 t 1 J n, i t = i=0 n i t i 1 t n i No local control. Degree restricted by the control polygon. http://www.cs.mtu.edu/~shene/courses/cs3621/notes/spline/bezier/bezier-move-ct-pt.html Terminology B 2 Q 3 x 3 Q 1 x x 4 2 Q 2 The B-Spline Curve of order k (degree, k-1)is given by: B i P t = B i N i,k t - position vectors of the n+1 vertices of the control polygon - normalized B-spline basis functions with t min t t max and 2 k B 5 x 1 Knot Point N i,1 = { 1, if x i t x i 1 0, otherwise Q 1 :,,,, x 1 t x 2 Control Point Q 2 :,,, B 5, x 2 t x 3 [ x 1, x 2, x 3, x 4 ] Knot Vector t = t x N t i i, k 1 x t N t i k i 1, k 1 x i k 1 x i x i k x i 1 Cox deboor recursive formula
Properties: The function P(t) is a polynomial of degree k-1 on each interval x i t x i 1 i.e., A 4 th -order B-spline curve is a piecewise cubic curve. P(t) and its derivatives of order 1 to k-2 are all continuous over the entire curve. Positivity t 0 t For k=2 Partition of Unity N i,k t =1for any t and k For k=3 For k=3
For k=3 For k=3 For k=4 For k=9
point on the curve lies within the convex hull of k If all vertices of the control polygon are collinear then the B-spline curve is a straight line. If at least k-1 coincident vertices of the defining polygon occur, i.e., B i =B i+1 =...=B i+k-2, then the convex hull of these vertices is the vertex itself and so the resulting curve must pass through this vertex. Knot Vectors and Basis functions The i 's are the knot values with, x i x i 1 The basis function t is zero outside the knot span x i x i k Total number of knot values is k, where is the number of vertices of the control polygon and k is the order of the b-spline curve. For e.g., =4,k=3 N i,1 = { 1,if x i t x i 1 0, otherwise t = t x N t i i, k 1 x t N t i k i 1,k 1 x i k 1 x i x i k x i 1 Cox deboor recursive formula N 1,3 x 1,, x 4 N 4,3 x 4,, x 7 [ x 1, x 2, x 3, x 4, x 5, x 6, x 7 ] Uniform (or periodic) knot vector : Individual knot values are evenly spaced. For e.g., [1,2,3,4] [ 0.2, 0.1, 0.0, 0.1,0.2] [0.0, 0.25, 0.50, 0.75, 1.0] For a given order k, uniform knot vectors yield periodic uniform basis functions for which t = N i 1, k t 1 = N i 1,k t 1 Uniform (or periodic) knot vector : Individual knot values are evenly spaced. For a given order k, uniform knot vectors yield periodic uniform basis functions for which: t =N i 1, k t 1 =N i 1, k t 1 Thus each basis function is a translate of the other. Mathematical Elements for Computer Graphics, 4ed., D. F. Rogers and J. A. Adams
Open uniform knot vector : this has a multiplicity of knot values at the ends of the knot vector equal to the order k of the b-spline basis function. Internal knot values are evenly spaced. For e.g., [0, 0,1,2,3, 4,4]for k =2 Formally, [0, 0,1/4, 1/2, 3/4,1,1]for k=2 1 i k x i ={0, i k, k 1 i n k 2, n 2 i n k 1 Open uniform knot vector : this has a multiplicity of knot values at the ends of the knot vector equal to the order k of the b-spline basis function. Internal knot values are evenly spaced. 1 i k Formally, x i ={0, i k, k 1 i n k 2, n 2 i n k 1 The basis functions look as shown N 1,4 N 4,4 [X ]=[0.0 0.0 0.0 0.0 1.01.0 1.0 1.0 ] for k=4, =4 N 2,4 N 3,4 Looks familiar? Open uniform knot vector : this has a multiplicity of knot values at the ends of the knot vector equal to the order k of the b-spline basis function. Internal knot values are evenly spaced. 1 i k Formally, x i ={0, i k, k 1 i n k 2, n 2 i n k 1 N 1,4 N 2,4 N 3,4 N 4,4 The basis functions look as shown [ X ]=[0.0 0.0 0.0 0.0 1.01.0 1.0 1.0 ] for k =4, =4 The B-spline basis reduces to the Bernstien basis when k=and an open uniform knot vector is used. Non-uniform knot vector : this has a unequally spaced and/or multiple internal knot values. They may be periodic or open. For e.g., [0 0 011 2 2 2],[0, 0.28,0.5, 0.72,1] Mathematical Elements for Computer Graphics, 4ed., D. F. Rogers and J. A. Adams
Buildup of b-spline basis functions Buildup of b-spline basis functions 1 N i 1, k 1 2 N i 1, k 2 N i 2, k 2 N i k 1, k N i k 1, k N i,k N i 1, k N i k 1, k N i 1,2 N i,2 N i 1,2 N i, 1 N i,1 N i 1,1 N i 2,1 N i 3,1 N i k 1,1 Buildup of b-spline basis functions 1 N 1,1 N 2,1 N 3,1 N 4,1 N 5,1 N 6,1 0 1 2 3 4 5 6 1 N 1,2 N 2,2 N 3,2 N 4,2 N 5,2 0 1 2 3 4 5 6 1 0 N 1,3 N 2,3 N 3,3 N 4,3 1 2 3 4 5 6 =4 k=1 k=2 k=3 Properties Strong Convex Hull Property Curve follows shape of control polygon Maximum order = number of control points Invariance to affine transformation Variation diminishing property
Controlling the B-Spline Knot Vector (uniform, open, non-uniform) Order of the curve Number and position of control points Order of the b-spline curve Open uniform knot vector k=3 k=2 k=4 Multiplicity of control points Open uniform knot vector, k=4 Control Polygon,,, Multiplicity of control points Open uniform knot vector, k=4 Control Polygon,,,, k=4 k=4
Multiplicity of control points Open uniform knot vector, k=4 Control Polygon,,,,, [0 0 0 01111] [0 0 0 0 12 22 2] [0 0 0 0 12 3333] Moving a control point Mathematical Elements for Computer Graphics, 4ed., D. F. Rogers and J. A. Adams To get a closed curve, repeat k 2 polygon vertices at the beginning or at the end Curve Fitting or Interpolating B-splines Curve Fitting or Interpolating B-splines Find a B-spline passing through D 1, D 2,...D j D 1 t 1 =N 1, k t 1 N 2,k t 1 t 1 B i D 2 t 2 =N 1,k t 2 N 2, k t 2 N i,k t 2 B i = D j =N 1,k N 2,k N i,k B i where 2 k j Find a B-spline passing through D 1, D 2,...D j D=N. B D=[D 1 t 1 D 2 t 2 D j ] T B=[ B i ] T N=[N 1, k t 1 N i,k t 1 N 1, k N i,k ]
Curve Fitting or Interpolating B-splines Find a B-spline passing through D 1, D 2,...D j B=N 1. D if 2 k = j Rational P h t = B h i t Question: What can rational curves do for us that polynomial curves cannot? t 1 =0, B=[ N T N ] 1 N T. D if 2 k j t l t max = l s=2 j s=2 D s D s 1 D s D s 1 for l 2 t max =maximum value of the knot vector P t = R i,k t = B i h i N i,k t h i t h i t h i t = B i R i,k t Non uniform knot vector + Rational B splines = NURBS