Komputer Grafik 2 AK 045206 SPLINE Spline 1

  • Slides: 24
Download presentation
Komputer Grafik 2 (AK 045206) SPLINE Spline 1

Komputer Grafik 2 (AK 045206) SPLINE Spline 1

Komputer Grafik 2 (AK 045206) Outline • • Spline History Bezier Curve Bezier Basis

Komputer Grafik 2 (AK 045206) Outline • • Spline History Bezier Curve Bezier Basis and Geometry Matrice Bezier Blending Function B Spline Curve B Spline Uniform Nonuniform, Rational, B Spline (NURBS) • Converting Between Spline 2

Komputer Grafik 2 (AK 045206) Splines History • Draftsman use ‘ducks’ and strips of

Komputer Grafik 2 (AK 045206) Splines History • Draftsman use ‘ducks’ and strips of wood (splines) to draw curves • Wood splines have second order continuity • And pass through the control points A Duck (weight) Ducks trace out curve Spline 3

Komputer Grafik 2 (AK 045206) Bézier Curves (1/2) • Similar to Hermite, but more

Komputer Grafik 2 (AK 045206) Bézier Curves (1/2) • Similar to Hermite, but more intuitive definition of endpoint derivatives • Four control points, two of which are knots Spline 4

Komputer Grafik 2 (AK 045206) Bézier Curves (2/2) • The derivative values of the

Komputer Grafik 2 (AK 045206) Bézier Curves (2/2) • The derivative values of the Bezier Curve at the knots are dependent on the adjacent points • The scalar 3 was selected just for this curve Spline 5

Komputer Grafik 2 (AK 045206) Bézier vs. Hermite • We can write our Bezier

Komputer Grafik 2 (AK 045206) Bézier vs. Hermite • We can write our Bezier in terms of Hermite – Note this is just matrix form of previous equations – Now substitute this in for previous Hermite Spline 6

Komputer Grafik 2 (AK 045206) Bézier Basis and Geometry Matrices • Matrix Form Spline

Komputer Grafik 2 (AK 045206) Bézier Basis and Geometry Matrices • Matrix Form Spline 7

Komputer Grafik 2 (AK 045206) Bézier Blending Functions • Look at the blending functions

Komputer Grafik 2 (AK 045206) Bézier Blending Functions • Look at the blending functions • This family of polynomials is called order 3 Bernstein Polynomials – C(3, k) tk (1 t)3 k; 0<= k <= 3 – They are all positive in interval [0, 1] – Their sum is equal to 1 • • Thus, every point on curve is linear combination of the control points The weights of the combination are all positive The sum of the weights is 1 Therefore, the curve is a convex combination of the control points Spline 8

Komputer Grafik 2 (AK 045206) Why more spline slides? • Bezier and Hermite splines

Komputer Grafik 2 (AK 045206) Why more spline slides? • Bezier and Hermite splines have global influence – Piecewise Bezier or Hermite don’t enforce derivative continuity at join points – Moving one control point affects the entire curve • B splines consist of curve segments whose polynomial coefficients depend on just a few control points – Local control Spline 9

Komputer Grafik 2 (AK 045206) B Spline Curve • Start with a sequence of

Komputer Grafik 2 (AK 045206) B Spline Curve • Start with a sequence of control points • Select four from middle of sequence (pi 2, pi 1, pi+1) d – Bezier and Hermite goes between pi 2 and pi+1 – B Spline doesn’t interpolate (touch) any of them but approximates the going through pi 1 and pi p 1 Q 4 Q 3 p 2 p 6 Q 5 p 3 p 0 Q 6 p 4 Spline p 5 10

Komputer Grafik 2 (AK 045206) Uniform B Splines • Approximating Splines • Approximates n+1

Komputer Grafik 2 (AK 045206) Uniform B Splines • Approximating Splines • Approximates n+1 control points – P 0, P 1, …, Pn, n ¸ 3 • Curve consists of n – 2 cubic polynomial segments – Q 3, Q 4, … Q n • t varies along B spline as Qi: ti <= t < ti+1 • ti (i =integer)are knot points that join segment Qi 1 to Qi • Curve is uniform because knots are spaced at equal intervals of parameter, t • First curve segment, Q 3, is defined by first four control points • Last curve segment, Qm, is defined by last four control points, Pm 3, Pm 2, Pm 1, Pm • Each control point affects four curve segments Spline 11

Komputer Grafik 2 (AK 045206) B spline Basis Matrix • Formulate 16 equations to

Komputer Grafik 2 (AK 045206) B spline Basis Matrix • Formulate 16 equations to solve the 16 unknowns • The 16 equations enforce the C 0, C 1, and C 2 continuity between adjoining segments, Q Spline 12

Komputer Grafik 2 (AK 045206) B Spline Basis Matrix • Note the order of

Komputer Grafik 2 (AK 045206) B Spline Basis Matrix • Note the order of the rows in my MB Spline is different from in the book – Observe also that the order in which I number the points is different – Therefore my matrix aligns with the book’s matrix if you reorder the points, and thus reorder the rows of the matrix Spline 13

Komputer Grafik 2 (AK 045206) B Spline (1/2) • Points along B Spline are

Komputer Grafik 2 (AK 045206) B Spline (1/2) • Points along B Spline are computed just as with Bezier Curves Spline 14

Komputer Grafik 2 (AK 045206) B Spline (2/2) • By far the most popular

Komputer Grafik 2 (AK 045206) B Spline (2/2) • By far the most popular spline used C 0, C 1, and C 2 continuous • Locality of points Spline 15

Komputer Grafik 2 (AK 045206) Nonuniform, Rational B Splines (NURBS) • The native geometry

Komputer Grafik 2 (AK 045206) Nonuniform, Rational B Splines (NURBS) • The native geometry element in Maya • Models are composed of surfaces defined by NURBS, not polygons • NURBS are smooth • NURBS require effort to make non smooth Spline 16

Komputer Grafik 2 (AK 045206) What is a NURB? • Nonuniform: The amount of

Komputer Grafik 2 (AK 045206) What is a NURB? • Nonuniform: The amount of parameter, t, that is used to model each curve segment varies – Nonuniformity permits either C 2, C 1, or C 0 continuity at join points between curve segments – Nonuniformity permits control points to be added to middle of curve Spline 17

Komputer Grafik 2 (AK 045206) What do we get? • NURBs are invariant under

Komputer Grafik 2 (AK 045206) What do we get? • NURBs are invariant under rotation, scaling, translation, and perspective transformations of the control points (nonrational curves are not preserved under perspective projection) – This means you can transform the control points and redraw the curve using the transformed points – If this weren’t true you’d have to sample curve to many points and transform each point individually – B spline is preserved under affine transformations, but that is all Spline 18

Komputer Grafik 2 (AK 045206) Converting Between Splines • Consider two spline basis formulations

Komputer Grafik 2 (AK 045206) Converting Between Splines • Consider two spline basis formulations for two spline types • We can transform the control points from one spline basis to another • With this conversion, we can convert a B Spline into a Bezier Spline • Bezier Splines are easy to render Spline 19

Komputer Grafik 2 (AK 045206) Rendering Splines • Horner’s Method • Incremental (Forward Difference)

Komputer Grafik 2 (AK 045206) Rendering Splines • Horner’s Method • Incremental (Forward Difference) Method • Subdivision Methods Spline 20

Komputer Grafik 2 (AK 045206) Horner’s Method • Three multiplications • Three additions Spline

Komputer Grafik 2 (AK 045206) Horner’s Method • Three multiplications • Three additions Spline 21

Komputer Grafik 2 (AK 045206) Forward Difference • But this still is expensive to

Komputer Grafik 2 (AK 045206) Forward Difference • But this still is expensive to compute – Solve for change at k (Dk) and change at k+1 (Dk+1) – Boot strap with initial values for x 0, D 0, and D 1 – Compute x 3 by adding x 0 + D 1 Spline 22

Komputer Grafik 2 (AK 045206) Subdivision Methods Spline 23

Komputer Grafik 2 (AK 045206) Subdivision Methods Spline 23

Komputer Grafik 2 (AK 045206) Referensi • • • . Hill, Jr. , COMPUTER

Komputer Grafik 2 (AK 045206) Referensi • • • . Hill, Jr. , COMPUTER GRAPHICS – Using Open GL, Second Edition, Prentice Hall, 2001 ______, Interactive Computer Graphic, Slide Presentation, (folder : Lect_IC_AC_UK) Michael CS 488/688 Mc. Cool, : Introduction to Computer Graphics, Lecture Notes, University of Waterloo, 2003 (lecturenotes. pdf) ______, CS 319 : Advance Topic in Computer Graphics, Slide Presentation, (folder : uiuc_cs) ______, CS 445/645 : Introduction to Computer Graphics, Slide Presentation, Virginia University (folder : COMP_GRAFIK) Spline 24