10-27-Ch10_2

download 10-27-Ch10_2

of 8

Transcript of 10-27-Ch10_2

  • 8/11/2019 10-27-Ch10_2

    1/8

  • 8/11/2019 10-27-Ch10_2

    2/8

    Slide 227 October 1999 CS 318 - Computer Graphics (Top Changwatchai)

    Spline Basics (1/3) Definitions

    Textbook calls a spline curveany composite curve formed

    with polynomial sections satisfying specified continuityconditions at the boundary of the pieces - can be 2D or 3D

    Spline surfacesformed from two sets of orthogonal spline

    curves

    From now on spline refers to spline curve

    Control points

    Used to specify spline curves

    Two ways to fit splines

    Interpolation - curve passes through each control point

    Approximation - curve does not necessarily pass through anycontrol point

    Convex hull

    minimum convex polygon boundary that encloses set of

    control points

  • 8/11/2019 10-27-Ch10_2

    3/8

    Slide 327 October 1999 CS 318 - Computer Graphics (Top Changwatchai)

    Spline Basics (2/3) Splines are specified using parametric equations

    P(u) = [ x(u) y(u) z(u) ] - row vector

    P(u) = Au3+ Bu2+ Cu + D - each of A, B, C, and D are row vectors

    From now on, we treat P as scalar:

    P(u) = au3+ bu2+ cu + d

    Unless otherwise specified, all derivatives are with respect to parameter u

    Continuity conditions (between two curve sections)

    parametric

    C0

    - same point C1- tangent lines (1stderivatives) equal

    C2- 1stand 2ndderivatives equal

    etc

    geometric

    G0= C0

    parametric derivatives proportional (in same direction) but not necessarily equal:

    G1, G2, etc

    note

    there exists a case where you can have G1continuity without C1continuity

    Local vs. global control

    Global control - if one point altered, the entire curve affected

    Local control - only that curve section is affected

  • 8/11/2019 10-27-Ch10_2

    4/8

    Slide 427 October 1999 CS 318 - Computer Graphics (Top Changwatchai)

    Spline Basics (3/3)

    Recall from previous slide

    P(u) = au3+ bu2+ cu + d

    We can write as: P(u) = U Co U = [ u3u2u 1 ] Co = [ a b c d ]T

    = U MsplineMgeom

    = B Mgeom

    U is the 14parameter vector

    Co is the 41 coefficient matrix

    Three methods of spline specification

    Boundary conditions

    Description given in English

    Actual values placed in 41 geometry vectorMgeom

    Basis matrix

    Msplineis the 4

    4 basis matrix This is constant for a given type of spline

    Co = MsplineMgeom

    Blending functions

    B is a 14 matrix representing the blending functions

    B = U Mspline= [ F0(u) F1(u) F2(u) F3(u) ]

  • 8/11/2019 10-27-Ch10_2

    5/8

    Slide 527 October 1999 CS 318 - Computer Graphics (Top Changwatchai)

    Types of Splines

    Why cubic?

    Higher order less stable, more complex to calculate Lower order dont look as good

    Cubic is smallest that specifies endpoints and derivatives,

    and which is nonplanar in 3D

    Cubic splines (interpolation)

    Natural

    Hermite

    Cardinal

    Kochanek-Bartels

    Bzier (approximation)

    B-splines (approximation)

    Other

  • 8/11/2019 10-27-Ch10_2

    6/8

    Slide 627 October 1999 CS 318 - Computer Graphics (Top Changwatchai)

    Review of Cubic Splines Features

    Cubic splines interpolate - passes through every control point

    We fit one curve section at a time between each pair of successive control

    points (u=0 to u=1)

    We have 4 coefficients (cubic) so for n curve sections need 4n boundary

    conditions

    Natural

    Boundary conditions: endpoints on control points, 1st and 2nd parametric

    derivatives match between adjacent curve sections

    Bad: exhibits global control

    Hermite

    Boundary conditions: endpoints on control points, parametric slope

    specified at control points

    Exhibits local control, but may be inconvenient to specify slopes

    Cardinal Same as Hermite, but we compute tangents from neighboring control points

    Has tension parameter t

    Kochanek-Bartels

    Same as cardinal but adds two additional parameters, bias and continuity

    Good for modelling abrupt changes

  • 8/11/2019 10-27-Ch10_2

    7/8Slide 727 October 1999 CS 318 - Computer Graphics (Top Changwatchai)

    Bzier Curves - Features

    Approximation

    Global control

    Number of control points determines degree of Bzier

    curve

    Easy to implement and calculate recursively

    Always passes through first and last control points

    Lies within convex hull

    Easy to connect sections together

  • 8/11/2019 10-27-Ch10_2

    8/8

    Slide 827 October 1999 CS 318 - Computer Graphics (Top Changwatchai)

    Note from 27 October lecture

    In class we went over how to derive the following boundary conditions from the definition of Bzier curve:

    P(0) = p0 P(1) = pn

    P'(0) = -np0+ np1 P'(1) = -npn-1+ npn

    Dr. Chawla points out that there is a simpler (though equivalent) way to view our derivation:

    For u= 0, we see that every term except the first has a uand therefore goes to 0.

    For u= 1, we see that every term except the last has a (1-u) and therefore goes to 0. So we have:

    Taking the parametric derivative, we get:

    For u= 0, we see that all terms except the first two have us and therefore go to 0.

    For u= 1, we see that all terms except the last two have (1-u)s and therefore go to 0. So we have:

    n

    k

    nkk uBEZu

    0

    , )(p)(P

    n

    n

    n

    n

    n

    n

    nnnu

    n

    nuu

    n

    nuu

    n

    nuu

    nuu

    nu

    nu

    p)1(1

    p)1(2

    p)1(2

    p)1(1

    p)1(0

    p)(P 1122

    2

    22

    2

    1

    10

    112

    1

    223

    2

    322

    2

    21

    1

    1

    0

    p)1()1)(1(1p)2)(1()2()1(2p

    )2()1()1(22

    p)1()1()1(1

    p)()1(0

    p)(P'

    n

    n

    nn

    n

    nn

    n

    nnnnn

    nun

    n

    unuun

    n

    uunuun

    n

    nuuuun

    nuuun

    nun

    u

    0p)0(P 0

    n

    n

    n

    np)1(P

    1p)(

    0p)0(P' 10

    nn

    nn

    n

    n

    n

    n

    nn

    p)1(

    1p)1(P' 1