
4: Parametric curves and surfaces Lecture 1: Euclidean, similarity, affine and projective transformations. Homo- geneous coordinates and matrices. Coordinate frames. Perspective projection and its matrix representation. Lecture 2: Vanishing points. Horizons. Applications of projective transforma- tions. Lecture 3: Convexity of point-sets, convex hull and algorithms. Conics and quadrics, implicit and parametric forms, computation of intersections. Lecture 4: Interpolating and Approximating Splines: Cubic splines, Bezier curves, B-splines 1 Introduction 4.1 In the last lecture we saw that curves can be represented conveniently in para- metric form. Eg in 2D ¡£¢¥¤§¦©¨ ¢ ¢ ¤¦¢ ¤¦¦ and we saw some “regular” curves like ellipses, and so on. In this lecture we introduce how to build “irregular” shaped curves in a piece- wise fashion out of splines. Splines are widely used in graphics and CAD — indeed one of the pioneers of their computational use, Pierre Bezier´ , developed his ideas while working for Renault in the 1970's. Example of an interpolating spline 4.2 An idea of what were are about can be gained by considering the following prob- lem How should one specify the path of a road through a number of villages ... Roads made up of separate functions ¡ . ¢¤ ¦¨¡ ¢¤ ¦ Continuous ¡ ¡! ¢¤ ¦¨¡" ¢¤ ¦ Smooth ¡ ¢¤$%¦©¨¡ ¢¤$%¦ # # Cont 2nd d? These are interpolating splines, because they actually go through the points. Later we will see approximating splines, where the points are control points, which define the shape of the curve, but do not necessary lie on the curve. Other constraints might be applied ... Eg, need to have particular orientation to meet other roads, rivers at right angles ... 2 Parameterization 4.3 ¤ Convenient to use as a global ¤ parameter along the entire curve, and xi P P i+1 as a local parameter running from 0 to 1 0 Pi between points. That is, within spline & , the local p=0 p=1 parameter is P P 1 p p m ¤)( ¤$ i i+1 ¤'¨ ¤$*( ¤$ Polynomials provide usable functions for the splines... But what degree to use ? Linear? — a “Roman Road” spline, so not smooth! Quadratic? — let's see ... Quadratic splines? 4.4 ¢+¤¦ ¡,¨ ¢- .¢¤/¦01¢+¤¦1¦ Think just with the part of Using the global parameterization Using the local parameterization 32 ¨ 465879¤$2.5;:<¤/= 32 ¨ 4 2 = > ¨ 465879¤!5;:<¤ > ¨ 465A7B5A: 2 ¨ 758?@:<¤ ¨ 7 2 2 This suggests: 1st choice 2 C 2 y Choose gradient at D . 0 2 2nd choice Use gradient and , to fit quadratic. y This fixes gradient at D . 2 > Gradients Use gradient and , = to fit next y equal ... and so on ... 1 ... Then repeat for part ... p p p 0 1 2 So for a continuous, smooth quadratic spline simply choose of gradient at the first (or any one) point, and the entire curve is fixed. Too sensitive to choice of gradient. Likely to oscillate. 3 Cubic splines 4.5 Now consider just the local parameterization of the & th cubic spline sequence. Again, we just look at — similar equations are written for — but you should 7 realize that the 4 , , etc are different. = ¢¥¤§¦ ¨ 4 5A7 ¤E5;: ¤ 5GF ¤$H I ¢KJL¦ ¨ 4 @¢1MN¦ ¨ 4O95A7P95A:Q95GFO ¢KJL¦ ¨ RS¨T7P ¢1MN¦ ¨ RSB¨U7P95V?@:QW58XYFO Re-arranging, and writing 3Z¢[M\¦©¨@ , 4O¨ @ 7P¨ R] :Q¨ X/¢%@¥^(_@%¦.(8?ORS/(ARS F ¨ (`?$¢% (a ¦!5VR 5VR We make the derivative equal at the junction of two splines. The is called Hermite 5cM b interpolation. So, for a b segment spline, there are degrees of freedom. How are the derivatives specified? 4.6 1. By external constraints (eg, the perpendicular road) 2. Automatically: ed$ For example, fit parabola to , , , R and use value of gradient at as the gradient . 2 R ¨cJ RSfG¨TJ Also need to choose end point gradients: eg, set and . 3. But, we could ask the 2nd derivatives to match as well. This is a natural cubic spline. 4 Natural cubic splines 4.7 Try a counting argument to show that we have sufficient d.o.f. Again we think only about the cubic: the cubic is similiar. 2 f D D Each of the b segments between and requires 4 parameters to specify the I g cubic in . b UNKNOWNS. (UM At each of b internal points on spline @ed$0¢[M\¦B¨hi iZ¢jJC¦B¨hi ¢[M\¦B¨h ¢[M\¦k¨U ¢jJC¦ ¢jJC¦ # l ed$ ed$ I g ¢ (hM\¦ b CONSTRAINTS At the end points @2m¢jJC¦©¨h@2 ¢[M\¦B¨h f f I ? CONSTRAINTS g g (8?on b Now, b so we can do it! The extra two degrees of freedom are setting the second derivatives at the end points: ¢jJC¦B¨TJ ¢1MN¦©¨TJ l l 2 f I ? CONSTRAINTS Computing Natural Cubic Splines 4.8 g g p b Don't solve for the cubic splines by inverting a b matrix. Instead ... Basic equations Leads to = ¢¥¤§¦ ¨ 4 5G7 ¤E5A: ¤ 5AF ¤$H 4 ¨ ¢¥¤§¦ ¨ 7 58?@: ¤E58XYF ¤/= 7 ¨ R # ¢¥¤§¦ ¨ ?i:Q]58qYFOr¤ :Qh¨ X/¢%@(ti-¦ (A?ORS/(8RS ¤s¨ J ¤,¨ M (`?$¢%i(t@%¦58RS<5uRS Put in and into the first two FOh¨ on the left. ¤v¨ M ¢ (UM\¦ ¤w¨cJ & Now equate the 2nd derivs ( for the & th section, for the th ... ?@:Qed$"5GqYFOed$ ¨ ?i:Q I ?$xyX/¢%@<(tied$z¦.(G?OR]{d$^(8RS{|5 q}x¥(`?<¢-i<(t@ed$z¦!58R]ed$"58R]~| ¨ ?<xrX/¢%i!(ti-¦ (A?ORS/(8R]¥| I g R]ed$5 R]W5uRS ¨ X}¢-i(tied$z¦ 5 Computing Natural Cubic Splines, ctd 4.9 To repeat g ed$ ¥ ed$ R 5 R 5uR ¨TX/¢% (a ¦ 2 2 2 C # ¢KJL¦©¨TJ : ¨TJ X/¢% (a ¦.(8?OR (AR ¨cJ At the first point, 2 . So and , so 2 2 ?OR 5uR ¨UX/¢% (t ¦ ¢[M\¦©¨TJ ?@: 5GqYF ¨TJ l f f Similarly for the end section f , so from which R d$!5u?OR ¨UX/¢% (a d$[¦ f f f f Gather all this together R]2 X/¢%>*(t@20¦ ? M g R X/¢% (t@20¦ M M = g R X/¢% (tC1¦ M M = H ¨ . . . . . g d$ d M M R]f X}¢-if,(t@f ¦ = d$ M ? RSf X}¢-if,(t@f ¦ Computing Natural Cubic Splines, ctd 4.10 Use row ops to simplify further to R]2 M C2 2 R M $ R M = = = ¨ . . . . . d$ d$ M Lf R]f M RSf f R R d$ f Then back substitute to find f , and so in reverse order. Having got the R 's substitute in to 4 ¨ 7 ¨ R :Q¨ X/¢%@¥^(_@%¦.(8?ORS/(ARS FO¨ (`?$¢%i*(ai-¦!5VRS95VRS 6 Approximating curves as opposed to interpolating 4.11 ¢%"¦1"¢%¦ In 2D each a polynomial in . Local control of curve. Important examples are Bezier´ curves and B-splines. Used in graphics, CAD, drawing packages ... Bezier´ curves 4.12 Bezier curves were one of the earliest spline curves. The curves were originally devised using the de Casteljau construction. First consider a Bezier curve of degree 1, 2 x1 D between D and 2 ¡,¨ ¢[M(t¦¡ 5;/¡ x (1−u) 21# D Now consider three control points, = x0 and set u ¨ ¢[M(t¦¡!2 5;/¡. 2 x1 ¨ ¢[M(t¦¡."5;/¡ = a 2 ¨ ¢[M(t¦ 5t ¡ 1 a 0 Then ¡ follows a quadratic Bezier curve x 0 x x ¡s¨ ¢[M(a¦ ¡!2.5u?ik¢[M(_"¦¡.5G ¡ = = 2 = 7 Carrying on ... 4.13 2l D = Now consider four control points, H and set 2 2 ¨ ¢1M(_"¦¡ 5t}¡ x x 2 ¨ ¢1M(_"¦¡.!5t}¡ 1 = u ¨ ¢1M(_"¦¡ 5t}¡ = = H u = 1 ¨ ¢1M(_"¦ 2 5G 2 u = 0 ¨ ¢1M(_"¦ "5G x0 x 3 = 2 ¡ ¨ ¢1M(_"¦ 5G Then ¡ follows a cubic Bezier curve 2 = = ¡£¢%"¦B¨ ¢- .¢%¦¢%"¦1¦z¨ ¢[M(o"¦H¡ 5X3.¢[M( ¦ ¡ 5X3 ¢1M/( ¦¡ 5)/Hz¡ J M = HT%Y Bezier´ curves of degree 3 4.14 2 ¡£¢%¦©¨ ¢[M(a¦ ¡ 58X@k¢[M(a¦Z=Z¡ 5AX3§=N¢[M(t¦¡ 5; ¡ J M H H = H %Y Properties ¡£¢jJC¦B¨¡!2 ¡£¢[M\¦©¨¡ and H , so that a Bezier´ curve interpolates its end control points.2 ¨cX/¢¡¡.^(¢¡2¦ Ei . Geometric significance? The curve lies inside the convex hull of its control points. The control points need not be planar. Is it always smooth It can have inflections. It can self-cross. 8 Blending functions — actually Bernstein basis functions 4.15 2 ¡£¢%"¦B¨ ¢[M(a¦ ¡ 58X3.¢[M(a¦Z=Z¡ 58X@§=N¢[M(t¦¡ 5; ¡ H H = H One can think of the coefficients of the control points as blending functions ¤£ ¢1M¥(t"¦ These are symmetric under . 1 3 3 ( 1 - u ) u 3 u 2 ( 1 - u ) 3 u ( 1 - u ) 2 0 0 1 Bezier´ curves of degree ¦ 4.16 The de Casteljau construction can be expressed as d © © ·Y¸$¹ ¨ ¢-¦¡ ¢%¦©¨ °±² ³ ´µ¶¢[M(a¦ J M ¡£¢%¦©¨ § © © ¬®­<¯ ¯ © § 2<« « ©+ª ¨TX e.g. for ² (cubic Bezier):´ 2 ¢-¦ ¨ ¢1M(_"¦ H « = ¢-¦ ¨ X/¢[M(t"¦ « ¢-¦ ¨ X/¢[M(t"¦= = « ¢-¦ ¨ H H « Note that (what is the geom significance?) ¨ ·Y¸$¹ § ¢-¦©¨ ¢¡o5º¢[M(t¦1¦ ¨ M ¢-¦¥»hJ J M © © § %Y « « 2 ©+ª 9 Matrix form 4.17 Another representation is ¡!2 M °¼ ´%½ °¼ ´%½ ¼ ½ ¼ ½ ¡. (ÀX ¼ ½ ¼ ½ 2 2 = ¡£¢%"¦B¨ ¢ ¢%¦ ¢%"¦ ¢%"¦ ¢-¦1¦ ¼ ½ ¢%¦©¨ ¢[M(t¦H¥¨ ¾M /H[¿ ¼ ½ ¼ ½ ¼ ½ = H ¡ 5`X « « « « « ¼ ½ ¼ ½ = ± µ ± µ ¡ (EM H Collecting these together: 2 M J J J ¡ °¼ ´%½ ¼ ½ (ÁX X J J ¡ ¼ ½ ¾ = ¿ ¼ ½ ¡¥¢%¦ ¨ M /H ¼ ½ X (Áq X J ¡ ¼ ½ = ± µ (ÂM X (ÀX M ¡ H ¨ ÃTÄWÅYÆ%Ç-ÈlÆ-É Ê Ä ÅYÆ%Ç-ÈlÆ-É is the Bezier basis matrix for order 3. Example 4.18 Where is ¡£¢jJ<Ë ÌO¦ ? M J J J ¡!2 ° ´ ¼ ½ ¼ ½ M M M M (ÀX X J J ¡. ¼ ½ ¡¥¢ ¦ ¨ Í3M ¼ ½ ¼ ½ Î/Ï g X (Àq X J ¡ ? ? ¼ ½ = ± µ (EM X (ÀX M ¡ H ¡2 ° ´ ¼ ½ ¼ ½ M X X M M ¡k ¼ ½ ¢zM¥XÀXEMN¦ ¼ ½ ¨ ¡!2.5 ¡."5 ¡ 5 ¡ ¨ ¼ ½ Î Î Î Î Î = H ¡ ¼ ½ = ± µ ¡ H So, it is a “centre-weighted centroid”.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages16 Page
-
File Size-