CS 430/585 Computer Graphics I B-Splines an NURBS Week 5, Lecture 9 Davi Breen, William Regli an Maxim Peysakhov Geometric an Intelligent Computing Laboratory Department of Computer Science Drexel University http://gicl.cs.rexel.eu Outline Types of 2D Curves Splines B-splines NURBS Knot sequences Effects of the weights 1 2 Splines Popularize in late 1960s in US Auto inustry (GM) R. Riesenfel (1972) W. Goron Origin: the thin woo or metal strips use in builing/ship construction Goal: efine a curve as a set of piecewise simple polynomial functions connecte Natural Splines Mathematical representation of physical splines C 2 continuous Interpolate all control points Have Global control P 1 (no local control) P 0 P 2 P n-2 P n P n-1 together 3 4 B-splines: Basic Ieas B-splines Similar to Bézier curves Smooth blening function times control points But: Blening functions are non-zero over only a small part of the parameter range (giving us local suppor When nonzero, they are the concatenation of smooth polynomials 5 Define similarly to Bézier curves p i are the control points Compute with basis functions (Basis-splines) B-spline basis functions are blening functions Each point on the curve is efine by the blening of the control points (B i is the i-th B-spline blening function) m p( Bi, ( pi i 0 6
B B B-splines: Cox-eBoor Recursion Cox-eBoor Algorithm: efines the blening functions for spline curves (not limite to eg 3) curves are weighte avgs of lower egree curves Let B i, ( enote the i-th blening function for a B-spline of egree, then: k,0 k, 1, if tk t < tk + 1 ( 0, otherwise t tk tk ( Bk, 1( + t t t k + k + + 1 k+ + 1 t t k + 1 B k+ 1, 1 ( 7 B-spline Blening Functions is a step function that is 1 in the B ( k, 0 interval spans two intervals an is a B k,1 ( piecewise linear function that goes from 0 to 1 (an back) spans three intervals an is a B ( piecewise quaratic that grows k, 2 from 0 to 1/4, then up to 3/4 in the mile of the secon interval, back to 1/4, an back to 0 is a cubic that spans four intervals growing from 0 to 1/6 to 2/3, then B ( k, 3 back to 1/6 an to 0 B-spline blening functions 8 Pics/Math courtesy of Dave Mount @ UMD-CP B-spline Blening Functions: Example for 2 n Orer Splines Note: can t efine a polynomial with these properties (both 0 an non-zero for ranges) Iea: subivie the parameter space into intervals an buil a piecewise polynomial Each interval gets ifferent polynomial function 9 Pics/Math courtesy of Dave Mount @ UMD-CP B-spline Blening Functions: Example for 3 Orer Splines Observe: at t0 an t1 just three of the functions are non-zero all are >0 an sum to 1, hence the convex hull property hols for each curve segment of a B-spline 10 B-splines: Setting the Options Specifie by m 3 m+1 control points, P 0 P m m-2 cubic polynomial curve segments, Q 3 Q m m-1 knot points, t 4 t m+1 segments Q i of the B-spline curve are efine over a knot interval [ t i, t i+ 1] efine by 4 of the control points, P i-3 P i segments Q i of the B-spline curve are blene together into smooth transitions via (the new & improve) blening functions 11 Example: Creating a B-spline Curve Segment Q i t i 1 t i P i 12
B-splines: Knot Selection B-spline: Knot Sequences Instea of working with the parameter space 0 t 1, use tmin t0 t1 t2... tm 1 t The knot points joint points between curve segments, Q i Each has a knot value m-1 knots for m+1 points 13 max Even istribution of knots uniform B-splines Curve oes not interpolate en points first blening function not equal to 1 at t0 Uneven istribution of knots non-uniform B-splines Allows us to tie own the enpoints by repeating knot values (in Cox-eBoor, 0/01) If a knot value is repeate, it increases the effect (weigh of the blening function at that point If knot is repeate times, blening function converges to 1 an the curve interpolates the control point 14 Creating a Non-Uniform B-spline: Knot Selection Given curve of egree 3, with m+1 control points first, create m-1+2(-1) knot points use knot values (0,0,0,1,2,, m-2, m-1,m-1,m-1) (aing two extra 0 s an m-1 s) Note Causes Cox-eBoor to give ae weight in blening to the first an last points when t is near t min an t max Watching Effects of Knot Selection 8 knot points (initially) Note: knots are istribute parametrically base on t, hence why they move 10 control points Curves have as many segments as they have non-zero intervals in u egree of curve 15 16 B-splines: Local Control Property B-splines: Local Control Property Local Control polynomial coefficients epen on a few points moving control point (P 4 ) affects only local curve Why: Base on curve ef n, affecte region extens at most 1 knot point away 17 18 Recore from: http://heim.ifi.uio.no/~tronbre/osloalgapp.html
Control: Bézier vs B-splines Observe the effect on the whole curve when controls are move B-splines: Convex Hull Property The effect of multiple control points on a uniform B-spline curve 19 20 B-splines: Continuity B-splines: Setting the Options Derivatives are easy for cubics p( u) k 0 Derivative: p c + 2c u + c u Easy to show C 0, C 1, C 2 3 u k c k 1 2 3 3 2 21 How to space the knot points? Uniform equal spacing of knots along the curve Non-Uniform Which type of parametric function? Rational x(, y(, z( efine as ratio of cubic polynomials Non-Rational 22 NURBS At the core of several moern CAD systems I-DEAS, Pro/E, Alpha_1 Describes analytic an freeform shapes Accurate an efficient evaluation algorithms Invariant uner affine an perspective transformations 23 U of Utah, Alpha_1 Benefits of Rational Spline Curves Invariant uner rotation, scale, translation, perspective transformations transform just the control points, then regenerate the curve (non-rationals only invariant uner rotation, scale an translation) Can precisely efine the conic sections an other analytic functions conics require quaratic polynomials conics only approximate with non-rationals 24
NURBS Non-uniform Rational B-splines: NURBS Basic iea: four imensional non-uniform B-splines, followe by normalization via homogeneous coorinates If P i is [x, y, z, 1], results are invariant wrt perspective projection Also, recall in Cox-eBoor, knot spacing is arbitrary knots are close together, influence of some control points increases Duplicate knots can cause points to interpolate e.g. Knots {0, 0, 0, 0, 1, 1, 1, 1} create a Bézier curve Rational Functions Cubic curve segments X ( Y ( Z( x (, y(, z( W ( W ( W ( where X (, Y (, Z(, W ( are all cubic polynomials with control points specifie in homogenous coorinates, [x,y,z,w] Note: for 2D case, Z( 0 25 26 Rational Functions: Example Example: rational function: a ratio of polynomials a rational parameterization in u of a unit circle in xy-plane: a unit circle in 3D homogeneous coorinates: NURBS: Notation Alert Depening on the source/reference Blening functions are either B i, or N i, Parameter variable is either u or t Curve is either C or P or Q Control Points are either P i or B i Variables for orer, egree, number of control points etc are frustratingly inconsistent k, i, j, m, n, p, L,,. 27 28 NURBS: Notation Alert NURBS 1. If efine using homogenous coorinates, the 4 th (3 r for 2D) imension of each P i is the weight 2. If efine as weighte eucliian, a separate constant w i, is efine for each control point 29 A -th egree NURBS curve C is ef as: C n i 0 i i, n 1 w i 0 ibi, Where control points, -th egree B-spline blening functions, the weight, w i, for control point P i (when all w i 1, we have a B-spline curve) 1 w B P i B i, 30
Observe: Weights Inuce New Rational Basis Functions, R Setting: R i w B i i, n 1 wi Bi, i 0 n 1 Allows us to write: ( ) C u Ri, Pi i 0 Where R are rational basis functions piecewise rational basis functions on u [0,1 weights are incorporate into the basis fctns i, ] 31 Geometric Interpretation of NURBS With Homogeneous coorinates, a rational n- D curve is represente by polynomial curve in (n+1)-d Homogeneous 3D control points are written as: in 4D where To get, ivie by w i a perspective transform with center at the origin Note: weights can allow final curve shape to go outsie the convex hull (i.e. negative w) 32 NURBS: Examples NURBS: Examples Unif. Knot Vector Non-Unif. Knot Vector {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0} {0.0, 1.0, 2.0, 3.75, 4.0, 4.25, 6.0, 7.0} Knot Vector {0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 6.0, 7.0} Several consecutive knots get the same value Bunches up the curve an forces it to interpolate 33 34 NURBS: Examples Knot Vector {0.0, 1.0, 2.0, 3.0, 3.0, 5.0, 6.0, 7.0} Several consecutive knots get the same value Bunches up the curve an forces it to interpolate Can be one micurve 35 The Effects of the Weights w i of P i effects only the range [u i, u i+k+1 ) If w i 0 then P i oes not contribute to C If w i increases, point B an curve C are pulle towar P i an pushe away from P j If w i ecreases, point B an curve C are pushe away from P i an pulle towar P j If w i approaches infinity then B approaches 1 an B i -> P i, if u in [u i, u i+k+1 ) 36
The Effects of the Weights Increase weight pulls the curve towar B 3 37