The Essentials of CAGD Chapter 3: Cubic B´ ezier Curves 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 / 29
Outline Introduction to Cubic B´ ezier Curves 1 Parametric Curves 2 Cubic B´ ezier Curves 3 Derivatives 4 The de Casteljau Algorithm 5 Subdivision 6 Exploring the Properties of B´ ezier Curves 7 The Matrix Form and Monomials 8 Farin & Hansford The Essentials of CAGD 2 / 29
Introduction to Cubic B´ ezier Curves Cubic B´ ezier curves – CAD/CAM – Graphic Design – Computer Graphics – Figure generated in PostScript Basic principles of B´ ezier curves easily explored via cubics Farin & Hansford The Essentials of CAGD 3 / 29
Parametric Curves Curve from calculus: function y = 2 x − 2 x 2 Graph of the function � x � � � x = 2 x − 2 x 2 y Parametric curve � x � � f ( t ) � = g ( t ) y f and g can be any kind of function Domain is the real line Try this: Parametric line thru 2 points Farin & Hansford The Essentials of CAGD 4 / 29
Parametric Curves Graph of a function � x � � � x = 2 x − 2 x 2 y as a parametric curve: � x � � � t x ( t ) = = 2 t − 2 t 2 y Rotate 90 degrees � − 2 t + 2 t 2 � x ( t ) = t Horizontal tangents do not characterize extreme points for parametric curves Farin & Hansford The Essentials of CAGD 5 / 29
Parametric Curves Parametric curves defined in 3D: x f ( t ) = g ( t ) x ( t ) = y z h ( t ) Simple example: a helix cos( t ) x ( t ) = sin( t ) t Farin & Hansford The Essentials of CAGD 6 / 29
Cubic B´ ezier Curves Focus of this book: B´ ezier curves – The most important type of polynomial curve – Named after Pierre B´ ezier – Defined for any polynomial degree – First focus on cubic case n = 3 Farin & Hansford The Essentials of CAGD 7 / 29
Cubic B´ ezier Curves − (1 − t ) 3 + t 3 � � x ( t ) = 3(1 − t ) 2 t − 3(1 − t ) t 2 Shape? Rewrite as a combination of points � − 1 � x ( t ) = (1 − t ) 3 0 � 0 � + 3(1 − t ) 2 t 1 � 0 � + 3(1 − t ) t 2 − 1 � 1 � + t 3 0 Farin & Hansford The Essentials of CAGD 8 / 29
Cubic B´ ezier Curves Cubic B´ ezier curve x ( t ) = (1 − t ) 3 b 0 + 3(1 − t ) 2 t b 1 + 3(1 − t ) t 2 b 2 + t 3 b 3 B´ ezier control points b i form the B´ ezier polygon Cubic Bernstein polynomials B 3 i 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 More on the Bernstein polynomials in the next chapter Farin & Hansford The Essentials of CAGD 9 / 29
Cubic B´ ezier Curves Properties: Endpoint interpolation 1 Symmetry 2 Invariance under affine maps 3 Convex hull property 4 Linear precision 5 Farin & Hansford The Essentials of CAGD 10 / 29
Cubic B´ ezier Curves t ∈ [ − 1 , 2] Convex hull property Extrapolation: t outside [0 , 1] – No convex hull property – Unpredictable behavior Farin & Hansford The Essentials of CAGD 11 / 29
Derivatives Tangent vector d x ( t ) = − 3(1 − t ) 2 b 0 d t + [3(1 − t ) 2 − 6(1 − t ) t ] b 1 + [6(1 − t ) t − 3 t 2 ] b 2 + 3 t 2 b 3 = 3[ b 1 − b 0 ](1 − t ) 2 + 6[ b 2 − b 1 ](1 − t ) t + 3[ b 3 − b 2 ] t 2 = 3∆ b 0 (1 − t ) 2 + 6∆ b 1 (1 − t ) t + 3∆ b 2 t 2 forward difference ∆ b i x ( t ) ≡ d x ( t ) / d t ˙ Farin & Hansford The Essentials of CAGD 12 / 29
Derivatives Example � 1 � (1 − t ) 2 x ( t ) = 3 ˙ 1 � 0 � + 6 (1 − t ) t − 2 � 1 � t 2 + 3 1 � 1 . 5 � x (0 . 5) = ˙ − 1 . 5 Farin & Hansford The Essentials of CAGD 13 / 29
Derivatives x ( t ) = 3∆ b 0 (1 − t ) 2 + 6∆ b 1 (1 − t ) t + 3∆ b 2 t 2 ˙ – Derivative of a cubic curve is a quadratic curve – Evaluating “derivative curve” produces vectors At the curve’s endpoints: x (0) = 3∆ b 0 ˙ x (1) = 3∆ b 2 ˙ ⇒ control polygon is tangent to the curve at the endpoints Chapter 4: higher order derivatives Farin & Hansford The Essentials of CAGD 14 / 29
The de Casteljau Algorithm Recursive algorithm that constructs the point x ( t ) on a B´ ezier curve Most important algorithm of all of CAGD Many practical and theoretical ramifications 1959 Paul de Faget de Casteljau Farin & Hansford The Essentials of CAGD 15 / 29
The de Casteljau Algorithm Given: b 0 , . . . , b 3 and t Find: x ( t ) b 1 0 = (1 − t ) b 0 + t b 1 b 1 1 = (1 − t ) b 1 + t b 2 b 1 2 = (1 − t ) b 2 + t b 3 b 2 0 = (1 − t ) b 1 0 + t b 1 1 b 2 1 = (1 − t ) b 1 1 + t b 1 2 x ( t ) = b 3 0 = (1 − t ) b 2 0 + t b 2 1 What operation is repeated? Farin & Hansford The Essentials of CAGD 16 / 29
The de Casteljau Algorithm Schematic tool b 0 b 1 b 1 0 b 1 b 2 b 2 1 0 b 1 b 2 b 3 b 3 2 1 0 Implementation: 1D array data structure sufficient Farin & Hansford The Essentials of CAGD 17 / 29
The de Casteljau Algorithm Example � 0 � − 1 � � 0 � � � 1 � x ( t ) = (1 − t ) 3 + 3(1 − t ) 2 t + 3(1 − t ) t 2 + t 3 0 1 − 1 0 Evaluate at t = 0 . 5 using the triangular schematic tool Make a sketch! Farin & Hansford The Essentials of CAGD 18 / 29
The de Casteljau Algorithm Just for fun: All intermediate points of many evaluations Farin & Hansford The Essentials of CAGD 19 / 29
The de Casteljau Algorithm Derivatives b 2 0 b 2 1 is tangent to the curve x ( t ) = 3[ b 2 1 − b 2 ˙ 0 ] Derivative as byproduct of point evaluation Great value computationally Farin & Hansford The Essentials of CAGD 20 / 29
Subdivision Curve over [0 , t ] b 0 , b 1 0 , b 2 0 , b 3 0 Curve over [ t , 1] b 3 0 , b 2 1 , b 1 2 , b 3 Find these control points: b 0 b 1 b 1 0 b 1 b 2 b 2 1 0 b 1 b 2 b 3 b 3 2 1 0 Subdivide at t = 0 . 5 Are the two curve arcs equal length? Farin & Hansford The Essentials of CAGD 21 / 29
Subdivision Repeated subdivision Polygon converges to curve Convergence is fast Application? Farin & Hansford The Essentials of CAGD 22 / 29
Subdivision Application: curve / line intersection True/False of minmax box / line intersection fast How is convex hull property used? Try outlining the intersection algorithm Farin & Hansford The Essentials of CAGD 23 / 29
Exploring the Properties of B´ ezier Curves Self-intersection Farin & Hansford The Essentials of CAGD 24 / 29
Exploring the Properties of B´ ezier Curves Two inflection points Cubic functions cannot have two inflection points ⇒ Parametric curves more flexible Farin & Hansford The Essentials of CAGD 25 / 29
Exploring the Properties of B´ ezier Curves Cusp: point where the first derivative vector vanishes See for yourself! Run the de Casteljau algorithm for t = 0 . 5 Farin & Hansford The Essentials of CAGD 26 / 29
The Matrix Form and Monomials Cubic B´ ezier curve: b ( 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 Rewrite in matrix form: B 3 0 ( t ) B 3 1 ( t ) � � b ( t ) = b 0 b 1 b 2 b 3 B 3 2 ( t ) B 3 3 ( t ) 1 − 3 3 − 1 1 0 3 − 6 3 t � � = b 0 b 1 b 2 b 3 t 2 0 0 3 − 3 t 3 0 0 0 1 Farin & Hansford The Essentials of CAGD 27 / 29
The Matrix Form and Monomials Monomial polynomials: 1 , t , t 2 , t 3 Reformulate a B´ ezier curve b ( t ) = b 0 + 3 t ( b 1 − b 0 ) + 3 t 2 ( b 2 − 2 b 1 + b 0 ) + t 3 ( b 3 − 3 b 2 + 3 b 1 − b 0 ) = a 0 + a 1 t + a 2 t 2 + a 3 t 3 What is the geometric interpretation of the a i ? Farin & Hansford The Essentials of CAGD 28 / 29
The Matrix Form and Monomials The monomial coefficients a i are defined as 1 − 3 3 − 1 0 3 − 6 3 � � � � = a 0 a 1 a 2 a 3 b 0 b 1 b 2 b 3 0 0 3 − 3 0 0 0 1 Inverse process: − 1 1 − 3 3 − 1 0 3 − 6 3 � � � � = b 0 b 1 b 2 b 3 a 0 a 1 a 2 a 3 0 0 3 − 3 0 0 0 1 Square matrix above is nonsingular ⇒ Any cubic curve can be written in B´ ezier or monomial form How do we know that the matrix is nonsingular? Farin & Hansford The Essentials of CAGD 29 / 29
Recommend
More recommend