CS 475 / CS 675 - Computer Graphics Modelling Curves 3 -
Bézier Splines n P t = i=0 No local control. B i J n,i t with 0 t 1 J n,i t = n i t i 1 t n i Degree restricted by the control polygon. http://www.cs.mtu.edu/~shene/courses/cs3621/notes/spline/bezier/bezier-move-ct-pt.html CS475/CS675 - Lecture 11 2
Terminology B 2 B 4 Q 3 x 3 Q 1 x x 4 2 Q 2 B 5 B 1 x 1 B 3 Knot Point Q 1 : B 1, B 2, B 3, B 4, x 1 t x 2 Q Control Point 2 : B 2, B 3, B 4, B 5, x 2 t x 3 [ x 1, x 2, x 3, x 4 ] Knot Vector CS475/CS675 - Lecture 11 3
The B-Spline Curve of order k (degree, k-1)is given by: n 1 P t = i=1 B i B i N i,k t with t min t t max and 2 k n 1 - position vectors of the n+1 vertices of the control polygon N i, k - normalized B-spline basis functions N i,1 ={ 1, if x t x i i 1 0, otherwise N i, k 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 Basis recursive formula CS475/CS675 - Lecture 11 4
Properties: The function P(t) is a polynomial of degree k-1 on each interval 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 N i, k t 0 t n 1 i=1 Partition of Unity N i,k t =1for any t and k x i t x i 1 CS475/CS675 - Lecture 11 5
Strong Convex Hull Property: For a B-spline curve of order k (degree k-1), a point on the curve lies within the convex hull of k neighbouring control points. For k=2 CS475/CS675 - Lecture 11 6
Strong Convex Hull Property: For a B-spline curve of order k (degree k-1), a point on the curve lies within the convex hull of k neighbouring control points. For k=3 CS475/CS675 - Lecture 11 7
Strong Convex Hull Property: For a B-spline curve of order k (degree k-1), a point on the curve lies within the convex hull of k neighbouring control points. For k=3 CS475/CS675 - Lecture 11 8
Strong Convex Hull Property: For a B-spline curve of order k (degree k-1), a point on the curve lies within the convex hull of k neighbouring control points. For k=3 CS475/CS675 - Lecture 11 9
Strong Convex Hull Property: For a B-spline curve of order k (degree k-1), a point on the curve lies within the convex hull of k neighbouring control points. For k=3 CS475/CS675 - Lecture 11 10
Strong Convex Hull Property: For a B-spline curve of order k (degree k-1), a point on the curve lies within the convex hull of k neighbouring control points. For k=4 CS475/CS675 - Lecture 11 11
Strong Convex Hull Property: For a B-spline curve of order k (degree k-1), a point on the curve lies within the convex hull of k neighbouring control points. For k=9 CS475/CS675 - Lecture 11 12
Strong Convex Hull Property: For a B-spline curve of order k (degree k-1), a point on the curve lies within the convex hull of k neighbouring control points. 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. CS475/CS675 - Lecture 11 13
Knot Vectors and Basis ={ functions N 1,if x i t x i 1 i,1 0, otherwise N i, k t = t x N t i i, k 1 x i k 1 x i The x i 's are the knot values with, x i x i 1 Cox-deBoor recursive formula x i k t N i 1, k 1 t x i k x i 1 The basis function N i, k t is zero outside the knot span x i x i k Total number of knot values is n 1 k,where n 1is the number of vertices of the control polygon and k is the order of the b-spline curve. For e.g., n 1=4, k=3 N 1,3 x 1,, x 4 [ x 1, x 2, x 3, x 4, x 5, x 6, x 7 ] N 4,3 x 4,, x 7 CS475/CS675 - Lecture 11 14
Types of Knot Vectors 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] k For a given order, uniform knot vectors yield periodic uniform basis functions for which N i, k t =N i 1, k t 1 =N i 1, k t 1 CS475/CS675 - Lecture 11 15
Types of Knot Vectors 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: N i, k 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 CS475/CS675 - Lecture 11 16
Types of Knot Vectors 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 [0, 0,1/4,1/2, 3/ 4,1,1] for k=2 Formally, x i ={0, i k, n k 2, 1 i k k 1 i n 1 n 2 i n k 1 CS475/CS675 - Lecture 11 17
Types of Knot Vectors 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 1 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, n 1=4 Looks familiar? CS475/CS675 - Lecture 11 18
Types of Knot Vectors 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 1 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, n 1=4 The B-spline basis reduces to the Bernstien basis when k=n 1and an open uniform knot vector is CS475/CS675 - Lecture 11 19 used.
Types of Knot Vectors 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 0112 2 2],[0, 0.28, 0.5, 0.72,1] Mathematical Elements for Computer Graphics, 4ed., D. F. Rogers and J. A. Adams CS475/CS675 - Lecture 11 20
Buildup of b-spline basis functions N i, k N i, k 1 N i 1, k 1 N i, k 2 N i 1, k 2 N i 2, k 2 N i,1 N i 1,1 N i 2,1 N i 3,1 N i k 1,1 CS475/CS675 - Lecture 11 21
Buildup of b-spline basis functions 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 CS475/CS675 - Lecture 11 22
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 n 1=4 k=1 0 1 0 1 1 2 3 4 5 6 N 1,2 N 2,2 N 3,2 N 4,2 N 5,2 1 2 3 4 5 6 N 1,3 N 2,3 N 3,3 N 4,3 k=2 k=3 0 1 2 3 4 5 6 CS475/CS675 - Lecture 11 23
Properties Strong Convex Hull Property Curve follows shape of control polygon Maximum order = number of control points Invariance to affine transformation Variation diminishing property CS475/CS675 - Lecture 11 24
Controlling the B-Spline Knot Vector (uniform, open, non-uniform) Order of the curve Number and position of control points CS475/CS675 - Lecture 11 25
Order of the b-spline curve Open uniform knot vector B 2 B 4 k=2 k=3 k=4 B 3 B 1 CS475/CS675 - Lecture 11 26
Multiplicity of control points Open uniform knot vector, k=4 Control Polygon B 1, B 2, B 3, B 4 B 2 B 4 k=4 B 3 B 1 CS475/CS675 - Lecture 11 27
Multiplicity of control points Open uniform knot vector, k=4 Control Polygon B 1, B 2, B 2, B 3, B 4 B 2 B 2 B 4 k=4 B 3 B 1 CS475/CS675 - Lecture 11 28
Multiplicity of control points Open uniform knot vector, k=4 [0 0 0 01111] [0 0 0 012 22 2] [0 0 0 012 3333] Control Polygon B 1, B 2, B 2, B 2, B 3, B 4 B 2 B 2 B 2 B 4 B 3 B 1 CS475/CS675 - Lecture 11 29
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 CS475/CS675 - Lecture 11 30
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 B 1 N 2, k t 1 B 2 N i, k t 1 B i D 2 t 2 =N 1, k t 2 B 1 N 2, k t 2 B 2 N i,k t 2 B i = D j t j =N 1, k t j B 1 N 2, k t j B 2 N i,k t j B i where 2 k n 1 j CS475/CS675 - Lecture 11 31
Curve Fitting or Interpolating B-splines 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 j ] T B=[ B 1 B 2 B i ] T N=[N 1, k t 1 N i,k t 1 N 1, k t j N i,k t j ] CS475/CS675 - Lecture 11 32
Curve Fitting or Interpolating B-splines Find a B-spline passing through D 1, D 2,...D j t 1 =0, B=N 1. D if 2 k n 1= j B=[ N T N] 1 N T. D if 2 k n 1 j t l t max = l D s D s 1 s=2 j s=2 D s D s 1 for l 2 t max is the last (and maximum) value in the knot vector CS475/CS675 - Lecture 11 33
Rational n 1 P h t = i=1 P t = n 1 i=1 n 1 i=1 B i h N i, k t B i h i N i,k t h i N i,k t n 1 = i=1 Question: What can rational curves do for us that polynomial curves cannot? B i R i,k t R i,k t = n 1 i=1 h i N i,k t h i N i, k t Non-uniform knot vector + Rational B-splines = NURBS CS475/CS675 - Lecture 11 34