the essentials of cagd
play

The Essentials of CAGD Chapter 11: Working with B-spline Curves - PowerPoint PPT Presentation

The Essentials of CAGD Chapter 11: Working with B-spline 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


  1. The Essentials of CAGD Chapter 11: Working with B-spline 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 / 20

  2. Outline Introduction to Working with B-spline Curves 1 Designing with B-spline curves 2 Least Squares Approximation 3 Shape Equations 4 Cubic Spline Interpolation 5 Cubic Spline Interpolation in a Nutshell 6 Farin & Hansford The Essentials of CAGD 2 / 20

  3. Introduction to Working with B-spline Curves How to use B-spline curves? B-spline curves popularity due to the many possible ways in which they can be “put to work” Farin & Hansford The Essentials of CAGD 3 / 20

  4. Designing with B-spline curves Find: a B-spline curve for the character “v” in some fancy font Most basic design process: Move individual control points until desired shape achieved Manual/interactive method ok for final fine tuning of shape Initial “guess” can be created faster with methods in this chapter Farin & Hansford The Essentials of CAGD 4 / 20

  5. Introduction to Working with B-spline Curves Many applications supply a large number of data points ⇒ from scanning devices Find a cubic B-spline curve approximating their shape Most popular method: least squares approximation Farin & Hansford The Essentials of CAGD 5 / 20

  6. Least Squares Approximation Cubic B-spline curve defined by – L polynomial segments – Assume simple domain knots ⇒ number of knots K = L + 5 – Knot sequence u 0 , . . . , u K − 1 Given P data points – p 0 , . . . , p P − 1 – Each p i associated with parameter value v i Find a cubic B-spline curve x ( u ) such that the distances � p i − x ( v i ) � are small Farin & Hansford The Essentials of CAGD 6 / 20

  7. Least Squares Approximation B-spline curve x ( u ) = d 0 N 3 0 ( u ) + . . . + d D − 1 N 3 D − 1 ( u ) Given points p i = x ( v i ) i = 0 , . . . , P − 1 leading to d 0 N 3 0 ( v 0 ) + . . . + d n N 3 D − 1 ( v 0 ) = p 0 . . . d 0 N 3 0 ( v P − 1 ) + . . . + d n N 3 D − 1 ( v P − 1 ) = p P − 1 In matrix form:  N 3 N 3    0 ( v 0 ) . . . D − 1 ( v 0 ) p 0   d 0 . . . .     . . .   .    =   . . .     .  .     . . d D − 1     N 3 N 3 0 ( v P − 1 ) . . . D − 1 ( v P − 1 ) p P − 1 M D = P Farin & Hansford The Essentials of CAGD 7 / 20

  8. Least Squares Approximation Linear system M D = P is overdetermined – Number P of data points > number D of curve control points Solution: multiply both sides by M T : M T M D = M T P Linear system with D equations in D unknowns – Square and symmetric coefficient matrix M T M – Solution straightforward since M T M always invertible (parameter values v j must be “evenly” distributed in domain knots) Farin & Hansford The Essentials of CAGD 8 / 20

  9. Least Squares Approximation Parameters to define: – How many segments L should the curve have? – How to choose the knots u j – How to choose the parameter values v i ? No universal answers – suggestions: Choose the parameters v i according to the chord length Select L ≈ P / 10 Choose u i such that approximately ten v j fall in each interval domain knot interval [ u i , u i +1 ] Farin & Hansford The Essentials of CAGD 9 / 20

  10. Shape Equations Possible data point defects: – noisy – unevenly distributed ⇒ Least squares approximation might fail to produce nice results Solution: modify method with shape information – Accept deviation from data for a better-shaped curve – Formulate conditions for the control polygon’s shape – Assumption: a polygon is nice if it does not wiggle much Expressed by computing second differences of control points ∆ 2 d i = d i − 2 d i +1 + d i +2 Less wiggle ⇒ smaller sum: S = � ∆ 2 d 0 � + . . . + � ∆ 2 d D − 3 � Farin & Hansford The Essentials of CAGD 10 / 20

  11. Shape Equations Example Top polygon: S = 6 � 0 � 0 � � 0 � � ∆ 2 d 0 = ∆ 2 d 1 = ∆ 2 d 2 = − 2 2 − 2 Bottom polygon: S = 2 � 0 � 0 � � � 0 � ∆ 2 d 0 = ∆ 2 d 1 = ∆ 2 d 2 = 0 − 2 0 ⇒ Bottom polygon is smoother Farin & Hansford The Essentials of CAGD 11 / 20

  12. Shape Equations Least squares approximation: Add shape equations to the overdetermined system d 0 − 2 d 1 + d 2 = 0 . . . d D − 3 − 2 d D − 2 + d D − 1 = 0 Overdetermined linear system becomes even more overdetermined Top: without shape equations Bottom: with shape equations Farin & Hansford The Essentials of CAGD 12 / 20

  13. Cubic Spline Interpolation Interpolation: # given data equals # unknown control points Given P data points p 0 , . . . , p P − 1 Interpolate with a cubic B-spline curve x ( u ) End knots of multiplicity three: u 0 = u 1 = u 2 u 3 , . . . , u K − 4 u K − 3 = u K − 2 = u K − 1 Junction points paired with p i x ( u 2 ) = p 0 , . . . ⇒ P − 1 curve segments ⇒ K = P + 4 knots ⇒ D = P + 2 control points Farin & Hansford The Essentials of CAGD 13 / 20

  14. Cubic Spline Interpolation Example Given P = 5 data points Need K = 5 + 4 = 9 knots 0 , 0 , 0 , 1 , 2 , 3 , 4 , 4 , 4 ⇒ D = 7 control points d 0 , . . . , d 6 Farin & Hansford The Essentials of CAGD 14 / 20

  15. Cubic Spline Interpolation Two more data items are needed than the curve has junction points Solution: add two more data items at the ends of the curve t s = ˙ x ( u 2 ) start tangent t e = ˙ x ( u K − 3 ) end tangent These are called end conditions Knots u 2 and u K − 3 are the first and last domain knots Bessel tangents method: extract tangents from interpolating parabola through first and last three data points – See The Essentials of CAGD for equation details Farin & Hansford The Essentials of CAGD 15 / 20

  16. Cubic Spline Interpolation Interpolation conditions: p 0 = x ( u 2 ) t s = ˙ x ( u 2 ) Simplified interpolation conditions: p 1 = x ( u 3 ) t s = ˙ x ( u 2 ) . . . p 1 = x ( u 3 ) t e = ˙ x ( u K − 3 ) . . . p P − 1 = x ( u K − 3 ) p P − 2 = x ( u K − 4 ) Triple end knots result in t e = ˙ x ( u K − 3 ) For unknowns d 1 , . . . , d D − 2 d 0 = p 0 and d D − 1 = p P − 1 ⇒ eliminates two unknowns ⇒ eliminates two equations Farin & Hansford The Essentials of CAGD 16 / 20

  17. Cubic Spline Interpolation Example Revisit previous example Assigning d 0 = p 0 and d 6 = p 4 System becomes p 0 = x (0) t s = ˙ x (0) t s = ˙ x (0) p 1 = x (1) p 1 = x (1) p 2 = x (2) p 2 = x (2) p 3 = x (3) p 3 = x (3) t e = ˙ x (4) t e = ˙ x (4) ⇒ five equations for the unknowns p 4 = x (4) d 1 , . . . , d 5 Farin & Hansford The Essentials of CAGD 17 / 20

  18. Cubic Spline Interpolation Each data point yields an equation of the form p i = d 0 N 3 0 ( u 2+ i ) + . . . + d D − 1 N 3 D − 1 ( u 2+ i ) Due to the local support property of B-spline curves p i = d i N 3 i ( u 2+ i ) + d i +1 N 3 i +1 ( u 2+ i ) + d i +2 N 3 i +2 ( u 2+ i ) ⇒ tridiagonal structure End conditions: first and last equation in the system – For tridiagonal structure, must involve only the first and last unknowns For the special case of equally spaced interior knots 6 p i = d i + 4 d i +1 + d i +2 for each equation involving a data point Farin & Hansford The Essentials of CAGD 18 / 20

  19. Cubic Spline Interpolation Example – Equally spaced knots – End tangent equations: t s = 3( d 1 − d 0 ) and t e = 3( d 6 − d 5 ) d 0 + 1       1 d 1 3 t s 3 / 2 7 / 2 1 d 2 6 p 1             1 4 1 d 3 = 6 p 2             1 7 / 2 3 / 2 6 p 3 d 4       d 6 − 1 1 d 5 3 t e Farin & Hansford The Essentials of CAGD 19 / 20

  20. Cubic Spline Interpolation in a Nutshell Input: – Data points p 0 , . . . , p P − 1 – A cubic B-spline knot sequence u 0 = u 1 = u 2 , u 3 , . . . , u K − 4 , u K − 3 = u K − 2 = u K − 1 K = P + 4 ⇒ P − 1 curve segments Find: cubic B-spline interpolant – Control points d 0 , . . . , d D − 1 where D = P + 2 – Each data point p i is associated with parameter u 2+ i Compute: Set d 0 = p 0 and d D − 1 = p P − 1 Create tangents t s and t e using Bessel tangent equations Set up the tridiagonal linear system of equations Solve the ( D − 2) × ( D − 2) linear system for d 1 , . . . , d D − 2 Farin & Hansford The Essentials of CAGD 20 / 20

Recommend


More recommend