The Essentials of CAGD Chapter 5: Putting Curves to Work Gerald Farin & Dianne Hansford CRC Press, Taylor & Francis Group, An A K Peters Book www.farinhansford.com/books/essentials-cagd � 2000 c Farin & Hansford The Essentials of CAGD 1 / 26
Outline Introduction to Putting Curves to Work 1 Cubic Interpolation 2 Interpolation Beyond Cubics 3 Aitken’s Algorithm 4 Approximation 5 Finding the Right Parameters 6 Hermite Interpolation 7 Farin & Hansford The Essentials of CAGD 2 / 26
Introduction to Putting Curves to Work Parametric curves describe geometric shapes Design methods: interpolation and approximation An interpolating polynomial curve Evaluated at forty points Intermediate steps in the computations shown (Aitken’s algorithm) Farin & Hansford The Essentials of CAGD 3 / 26
Cubic Interpolation Given: 2D or 3D points p 0 , p 1 , p 2 , p 3 Find: curve passing through them Called interpolation Fit with a cubic B´ ezier curve Assign parameter values x ( t i ) = p i Requirement: t i ≤ t i +1 Example: t i = i / 3 Farin & Hansford The Essentials of CAGD 4 / 26
Cubic Interpolation Given: four point and parameter pairs p i , t i Find: a cubic B´ ezier curve x ( t ) such that x ( t i ) = p i i = 0 , 1 , 2 , 3 x ( t ) = B 3 0 ( t ) b 0 + B 3 1 ( t ) b 1 + B 3 2 ( t ) b 2 + B 3 3 ( t ) b 3 B 3 B 3 B 3 B 3 p 0 0 ( t 0 ) 1 ( t 0 ) 2 ( t 0 ) 3 ( t 0 ) b 0 B 3 B 3 B 3 B 3 0 ( t 1 ) 1 ( t 1 ) 2 ( t 1 ) 3 ( t 1 ) p 1 b 1 = B 3 B 3 B 3 B 3 p 2 0 ( t 2 ) 1 ( t 2 ) 2 ( t 2 ) 3 ( t 2 ) b 2 B 3 B 3 B 3 B 3 0 ( t 3 ) 1 ( t 3 ) 2 ( t 3 ) 3 ( t 3 ) p 3 b 3 P = M B Solution: B = M − 1 P Farin & Hansford The Essentials of CAGD 5 / 26
Cubic Interpolation Example: Given p i and t i = i / 3 � 0 � − 1 � � 0 � � � 1 � 0 1 − 1 0 27 0 0 0 M = 1 8 12 6 1 1 6 12 8 27 0 0 0 27 − 1 0 0 1 B : 0 − 1 1 0 Farin & Hansford The Essentials of CAGD 6 / 26
Cubic Interpolation Example con’t: Given p i and t i = i / 3 � � � � � � � � − 1 0 0 1 0 1 − 1 0 Linear system solver returns − 1 0 7 / 6 9 / 2 − 7 / 6 − 9 / 2 1 0 b i for interpolating cubic: � � � � � � � � − 1 7 / 6 − 7 / 6 1 0 9 / 2 − 9 / 2 0 Farin & Hansford The Essentials of CAGD 7 / 26
Interpolation Beyond Cubics Polynomial interpolation for given data points p 0 , . . . , p n Also given: corresponding parameter values t 0 , . . . , t n Interpolation problem leads to the linear system P = M B M is an ( n + 1) × ( n + 1) matrix with elements m i , j = B n j ( t i ) Solve using any linear system solver Farin & Hansford The Essentials of CAGD 8 / 26
Interpolation Beyond Cubics Polynomial interpolation is guaranteed to work Does not always produce satisfying results for higher degrees Top: 16 points on a semicircle Bottom: one data point changed x -coordinate of gray data point modified by 0.002 A small change in data can lead to large changes in the interpolating curve ⇒ ill-conditioned process Farin & Hansford The Essentials of CAGD 9 / 26
Interpolation Beyond Cubics Interpolating curve can be in form other than B´ ezier – Different polynomial forms will give the identical result Example: monomial form x ( t ) = a 0 + a 1 t + . . . + a n t n Unknowns are the coefficients a i Linear system: P = M A M is an ( n + 1) × ( n + 1) matrix with elements m i , j = t j i Farin & Hansford The Essentials of CAGD 10 / 26
Interpolation Beyond Cubics Example: Lagrange polynomials ( t − t 0 ) . . . ( t − t i − 1 )( t − t i +1 ) . . . ( t − t n ) L n i ( t ) = ( t i − t 0 ) . . . ( t i − t i − 1 )( t i − t i +1 ) . . . ( t i − t n ) ( ∗ − t i ) term missing in numerator and denominator of i th polynomial Allow a very direct form for the interpolant: x ( t ) = L n 0 ( t ) p 0 + . . . + L n n ( t ) p n ⇒ Data points appear explicitly – Called the cardinal form of the interpolant Farin & Hansford The Essentials of CAGD 11 / 26
Aitken’s Algorithm Recursive algorithm to compute points on interpolating polynomial curve – Some of the characteristics of the de Casteljau algorithm Derive via cubic case Start with 2 quadratic curves p 2 0 ( t ) through p 0 , p 1 , p 2 p 2 1 ( t ) through p 1 , p 2 , p 3 Construct interpolating cubic: 0 ( t ) = t 3 − t 0 ( t ) + t − t 0 p 3 p 2 p 2 1 ( t ) t 3 − t 0 t 3 − t 0 Farin & Hansford The Essentials of CAGD 12 / 26
Aitken’s Algorithm 0 ( t ) = t 3 − t 0 ( t ) + t − t 0 p 3 p 2 p 2 1 ( t ) t 3 − t 0 t 3 − t 0 Verify interpolation to all four data points Check p 0 : 0 ( t 0 ) = t 3 − t 0 0 ( t 0 ) + t 0 − t 0 p 3 p 2 p 2 1 ( t 0 ) = p 0 t 3 − t 0 t 3 − t 0 Check p 1 : – Observe that the factors sum to one – Both p 2 0 ( t 1 ) = p 1 and p 2 1 ( t 1 ) = p 1 ⇒ p 3 0 ( t 1 ) = p 1 Same idea for p 2 and p 3 Farin & Hansford The Essentials of CAGD 13 / 26
Aitken’s Algorithm Finding the quadratic interpolants – Same process works again: 0 ( t ) = t 2 − t 0 ( t ) + t − t 0 p 2 p 1 p 1 1 ( t ) t 2 − t 0 t 2 − t 0 1 ( t ) = t 3 − t 1 ( t ) + t − t 1 p 2 p 1 p 1 2 ( t ) t 3 − t 1 t 3 − t 1 New terms p 1 i are simply linear interpolants of the data 1 ( t ) = t 2 − t p 1 + t − t 1 p 1 p 2 t 2 − t 1 t 2 − t 1 Farin & Hansford The Essentials of CAGD 14 / 26
Aitken’s Algorithm Just as in the de Casteljau algorithm Convenient to arrange the intermediate points in a triangular array: p 0 p 1 p 1 0 p 1 p 2 p 2 1 0 p 1 p 2 p 3 p 3 2 1 0 Left-most column: given points (and parameter values) Aitken’s algorithm computes the points in each successive column Point on the curve is p 3 0 Farin & Hansford The Essentials of CAGD 15 / 26
Aitken’s Algorithm Example: Evaluate at t = 1 . 5 Interpolating cubic through � 0 � − 1 � � 0 � � � 1 � p 0 = p 1 = p 2 = p 3 = 0 1 − 1 0 ( t 0 , t 1 , t 2 , t 3 ) = (0 , 1 , 2 , 3) � � − 1 0 � � � � 0 0 . 5 1 1 . 5 � 0 � � 0 � � 0 . 125 � − 1 0 0 . 375 � 1 � � − 0 . 5 � � − 0 . 125 � � 0 � = p 3 0 (1 . 5) 0 − 1 . 5 − 0 . 375 0 A sampling of the computation of the intermediate points: p 1 p 2 0 = 0 . 25 p 1 0 + 0 . 75 p 1 p 3 0 = 0 . 5 p 2 0 + 0 . 5 p 2 0 = − 0 . 5 p 0 + 1 . 5 p 1 1 1 Farin & Hansford The Essentials of CAGD 16 / 26
Aitken’s Algorithm n th degree interpolating curve for r = 1 , . . . , n for i = 0 , . . . , n − r i ( t ) = t i + r − t t − t i p r − 1 p r − 1 p r ( t ) + i +1 ( t ) i t i + r − t i t i + r − t i Linear interpolation between p r − 1 and p r − 1 i +1 over [ t i + r , t i ] i ⇒ Affine map of interval onto line through p r − 1 and p r − 1 i +1 i Example: See chapter introduction Figure Polynomial interpolation is a global operation – Every data point involved in calculation Farin & Hansford The Essentials of CAGD 17 / 26
Approximation Some data not suited to interpolation – Too many data points ⇒ Higher degree interpolation is ill-conditioned – Data may be noisy Approximation: curve passes “near” points – Still captures shape suggested by given points Farin & Hansford The Essentials of CAGD 18 / 26 Least squares approximation: best known technique
Approximation Least squares approximation Given: l + 1 data points p 0 , . . . , p l and parameter values t i Find: polynomial curve x ( t ) of a given degree n such that distances � p i − x ( t i ) � are small Ideal situation: b 0 B n 0 ( t i ) + . . . + b n B n p i = x ( t i ) i = 0 , . . . , l ⇒ n ( t i ) = p i B n B n 0 ( t 0 ) . . . n ( t 0 ) p 0 b 0 . . . . . . . . = . . . . . . . b n B n B n 0 ( t l ) . . . n ( t l ) p l M B = P Farin & Hansford The Essentials of CAGD 19 / 26
Approximation Least squares approximation continued Assume number of data points l > degree n of the curve ⇒ linear system is overdetermined Multiply both sides by M T : M T M B = M T P Linear system with n + 1 equations in n + 1 unknowns – Square and symmetric coefficient matrix M T M – M T M always invertible – System of normal equations Curve B is the one polynomial of degree n which minimizes the sum of the � p i − x ( t i ) � Farin & Hansford The Essentials of CAGD 20 / 26
Approximation Example: 79 data (noisy) points from a cross section of a wing Parameter values selected to reflect the spacing of the data Approximated by a least squares quintic Choice of the “right” degree for this type of problem not easy – Trial and error or application dependent Farin & Hansford The Essentials of CAGD 21 / 26
Recommend
More recommend