The Essentials of CAGD Chapter 4: B´ ezier Curves: Cubic and Beyond 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 / 33
Outline Introduction to B´ ezier Curves: Cubic and Beyond 1 B´ ezier Curves 2 Derivatives Revisited 3 The de Casteljau Algorithm Revisited 4 The Matrix Form and Monomials Revisited 5 Degree Elevation 6 Degree Reduction 7 B´ ezier Curves over General Intervals 8 Functional B´ ezier Curves 9 10 More on Bernstein Polynomials Farin & Hansford The Essentials of CAGD 2 / 33
Introduction to B´ ezier Curves: Cubic and Beyond An excerpt from P. de Casteljau’s writings B´ ezier curves are not restricted to cubics – Here we explore these more general curves Farin & Hansford The Essentials of CAGD 3 / 33
B´ ezier Curves A B´ ezier curve of degree n x ( t ) = b 0 B n 0 ( t )+ b 1 B n 1 ( t )+ . . . + b n B n n ( t ) B n i ( t ) are Bernstein polynomials � n � B n (1 − t ) n − i t i i ( t ) = i Binomial coefficients: � n ! � n � 0 ≤ i ≤ n if i !( n − i )! = i 0 else B 4 i ( t ) over [0 , 1] (1 − t ) 4 4(1 − t ) 3 t 6(1 − t ) 2 t 2 4(1 − t ) t 3 t 4 Farin & Hansford The Essentials of CAGD 4 / 33
B´ ezier Curves Several examples of higher degree B´ ezier curves User might influence the shape by – Adding more control points – Moving control points Properties from the cubic case carry over Farin & Hansford The Essentials of CAGD 5 / 33
Derivatives Revisited x ( t ) = n [∆ b 0 B n − 1 + . . . + ∆ b n − 1 B n − 1 n − 1 ] where ∆ b i = b i +1 − b i ˙ 0 ⇒ A degree n − 1 B´ ezier curve with vector coefficients The k th derivative d k x ( t ) n ! ( n − k )![∆ k b 0 B n − k ( t ) + . . . + ∆ k b n − k B n − k = n − k ( t )] 0 d t k ∆ k is the forward difference operator – recursively defined by ∆ k b i = ∆ k − 1 b i +1 − ∆ k − 1 b i ∆ 0 b i = b i where Examples: k = 2 : b i +2 − 2 b i +1 + b i k = 3 : b i +3 − 3 b i +2 + 3 b i +1 − b i k = 4 : b i +4 − 4 b i +3 + 6 b i +2 − 4 b i +1 + b i Farin & Hansford The Essentials of CAGD 6 / 33
Derivatives Revisited At the endpoints the derivative calculations simplify (Abbreviated notation for the k th derivative) n ! x ( k ) (0) = ( n − k )!∆ k b 0 n ! x ( k ) (1) = ( n − k )!∆ k b n − k One nice feature of B´ ezier curves: Simple geometric interpretation of the first and second derivatives at the endpoints Farin & Hansford The Essentials of CAGD 7 / 33
Derivatives Revisited Example � − 1 � � 0 � x ( t ) = (1 − t ) 3 + 3(1 − t ) 2 t 0 1 � 0 � � 1 � + 3(1 − t ) t 2 + t 3 − 1 0 x (0) = 6∆ 2 b 0 = 6( b 2 − 2 b 1 + b 0 ) ¨ � 0 � � 0 � � − 1 � ¨ x (0) = 6( − 2 + ) − 1 1 0 � − 6 � = − 18 Farin & Hansford The Essentials of CAGD 8 / 33
The de Casteljau Algorithm Revisited Evaluation of a degree n B´ ezier curve via the de Casteljau algorithm for r = 1 , . . . , n for i = 0 , . . . , n − r i ( t ) = (1 − t ) b r − 1 + t b r − 1 b r i +1 i Point on the curve: x ( t ) = b n 0 ( t ) Several de Casteljau algorithm evaluations of a degree four B´ ezier curve Note locus of each b r i ( t ) Farin & Hansford The Essentials of CAGD 9 / 33
The de Casteljau Algorithm Revisited The de Casteljau algorithm subdivides the curve into a “left” and a “right” segment b 0 , b 1 0 , . . . , b n 0 b n 0 , b n − 1 , . . . , b n 1 Recall: these are points along diagonal and base of the schematic triangular diagram Quintic curve subdivided at t = 3 / 4 Farin & Hansford The Essentials of CAGD 10 / 33
The de Casteljau Algorithm Revisited The de Casteljau algorithm provides a way for computing the first derivative x ( t ) = n [ b n − 1 − b n − 1 ˙ ] 1 0 Difference of the points in the next to last step First derivative of a quartic curve at t = 1 / 2 Farin & Hansford The Essentials of CAGD 11 / 33
The de Casteljau Algorithm Revisited Second derivative can also be extracted from the de Casteljau algorithm x ( t ) = n ( n − 1)[ b n − 2 − 2 b n − 2 + b n − 2 ¨ ] 2 1 0 A scaling of the second difference of the ( n − 2) nd column in the schematic triangular diagram Farin & Hansford The Essentials of CAGD 12 / 33
The Matrix Form and Monomials Revisited Sometimes convenient to write a B´ ezier curve in matrix form Generalizing the cubics Define two vectors N and B by B n 0 ( t ) b 0 . . . . N = B = . . B n n ( t ) b n then the B´ ezier curve becomes x ( t ) = N T B This notation will be useful for dealing with surfaces Farin & Hansford The Essentials of CAGD 13 / 33
The Matrix Form and Monomials Revisited Matrix notation useful for converting between the Bernstein and monomial basis functions Recall for cubics: 1 − 3 3 − 1 1 0 3 − 6 3 t � b 0 � b ( t ) = b 1 b 2 b 3 t 2 0 0 3 − 3 t 3 0 0 0 1 1 − 3 3 − 1 0 3 − 6 3 � a 0 � � b 0 � a 1 a 2 a 3 = b 1 b 2 b 3 0 0 3 − 3 0 0 0 1 Columns ⇒ scaled forms of the derivative at t = 0 � n � ∆ i b 0 a 0 = b 0 and a i = for i = 1 . . . n i Farin & Hansford The Essentials of CAGD 14 / 33
The Matrix Form and Monomials Revisited The Bernstein form is more appealing from a geometric point of view – Curve defined by control points which mimic the shape of the curve Monomial form defined in terms of its derivatives Bernstein form numerically more stable than the monomial form Farin & Hansford The Essentials of CAGD 15 / 33
Degree Elevation A degree n polynomial is also one of degree n + 1 – Leading monomial form coefficient is zero A quadratic B´ ezier curve to demonstrate x ( t ) = (1 − t ) 2 b 0 + 2(1 − t ) t b 1 + t 2 b 2 Trick: multiply the quadratic expression by [ t + (1 − t )] Results in a cubic curve with control points 1 [1 3 b 0 + 2 2 [2 3 b 1 + 1 x ( t ) = B 3 0 b 0 + B 3 3 b 1 ] + B 3 3 b 2 ] + B 3 3 b 2 Trace of the cubic form of curve identical to original quadratic Farin & Hansford The Essentials of CAGD 16 / 33
Degree Elevation Example: Quadratic B´ ezier curve � 0 � � 3 � � 6 � b 0 = b 1 = b 2 = 0 3 0 Degree elevation results in x ( t ) = c 0 B 3 0 + c 1 B 3 1 + c 2 B 3 2 + c 3 B 3 3 � 0 � c 0 = b 0 = 0 c 1 = [1 3 b 0 + 2 � � 2 3 b 1 ] = 2 c 2 = [2 3 b 1 + 1 � 4 � 3 b 2 ] = 2 Curve drawn incorrectly � 3 � � � 6 Max y -value occurs at 3 / 2 c 3 = b 2 = 0 Farin & Hansford The Essentials of CAGD 17 / 33
Degree Elevation Degree n B´ ezier curve with control polygon b 0 , . . . , b n Degree elevate to B´ ezier curve with control polygon c 0 , . . . , c n +1 c 0 = b 0 . . . i i c i = n + 1 b i − 1 + (1 − n + 1) b i . . . c n +1 = b n Farin & Hansford The Essentials of CAGD 18 / 33
Degree Elevation Written as a matrix operation 1 ⋆ ⋆ b 0 c 0 ⋆ ⋆ . . . . = . . . . . . . . b n c n +1 ⋆ ⋆ 1 Abbreviated: D B = C D is ( n + 2) × ( n + 1) Example: 1 0 0 c 0 b 0 1 / 3 2 / 3 0 c 1 = b 1 0 2 / 3 1 / 3 c 2 b 2 0 0 1 c 3 Farin & Hansford The Essentials of CAGD 19 / 33
Degree Elevation Degree elevation may be applied repeatedly Resulting sequence of control polygons will converge to the curve Convergence is too slow for practical purposes Farin & Hansford The Essentials of CAGD 20 / 33
Degree Reduction Some CAD systems allow up to degree 40 and others use degree 3 only Reducing a degree 40 curve to a cubic is not trivial – In practice several degree 3 curves needed ⇒ Interplay between subdivision and degree reduction Farin & Hansford The Essentials of CAGD 21 / 33
Degree Reduction Must approximate a degree n + 1 curve by degree n curve Recall degree elevation 1 ⋆ ⋆ b 0 c 0 ⋆ ⋆ . . . = . D B = C . . . . . . . . b n c n +1 ⋆ ⋆ 1 Degree reduction: Given C then find B Problem: D not a square matrix → cannot invert Solution: multiply both sides by D T D T D B = D T C Farin & Hansford The Essentials of CAGD 22 / 33
Degree Reduction Example: Revisit degree elevation example 1 0 0 c 0 b 0 1 / 3 2 / 3 0 c 1 = b 1 0 2 / 3 1 / 3 c 2 b 2 0 0 1 c 3 10 2 0 2 2 D T D = 1 D T C = 1 2 8 2 12 8 9 3 0 2 10 22 2 First column of D T C corresponds to the x − components Second column corresponds to the y − components – x and y sent separately to linear system solver 0 0 � 0 � � 3 � � 6 � B = 3 3 ⇒ b 0 = b 1 = b 2 = 0 3 0 6 0 Farin & Hansford The Essentials of CAGD 23 / 33
Recommend
More recommend