Lect28 Curves+Surfaces2

download Lect28 Curves+Surfaces2

of 27

Transcript of Lect28 Curves+Surfaces2

  • 7/27/2019 Lect28 Curves+Surfaces2

    1/27

    159.235 Graphics 1

    159.235 Graphics & Graphical

    Programming

    Lecture 28 - Curves & Surfaces II

  • 7/27/2019 Lect28 Curves+Surfaces2

    2/27

    159.235 Graphics 2

    Uniform Non-rational B-Splines

    For each i 4 , there is a knot between Qi-1 and Qi at t = ti.

    Initial points at t3 and tm+1 are also knots. The following

    illustrates an example with control points set P0 P

    9:

    Knot.

    Control point.

    m=9 (10 control points)m-1 knots

    m-2 knot intervals.

  • 7/27/2019 Lect28 Curves+Surfaces2

    3/27

    159.235 Graphics 3

    Uniform Non-rational B-Splines

    First segment Q3 is defined by pointP0 throughP3 over the

    range t3 = 0 to t4 = 1. So m at least 3 for cubic spline.

    Knot.

    Control point.P1

    P2

    P3

    P0

    Q3m=9 (10 control points)

    m-1 knots

    m-2 knot intervals.

  • 7/27/2019 Lect28 Curves+Surfaces2

    4/27

    159.235 Graphics 4

    Uniform Non-rational B-Splines

    Second segment Q4 is defined by pointP1 throughP4 overthe range t4 = 1 to t5= 2.

    Knot.

    Control point.

    Q4

    P1

    P3

    P4

    P2

    m=9 (10 control points)m-1 knots

    m-2 knot intervals.

  • 7/27/2019 Lect28 Curves+Surfaces2

    5/27

    159.235 Graphics 5

    Uniform Non-Rational B-Splines

    The unweighted spline set will look as follows, 10 control

    points, 10 splines, but only 8 knots and 7 knot intervals.

    You can see why t3

    to t4

    is the first interval with a curve

    since it is the first with all four B-Spline functions.

    t9 to t10 is the last interval, t3 to tm+1 are the knots.

    43

    t86 mm+1

    0

  • 7/27/2019 Lect28 Curves+Surfaces2

    6/27

    159.235 Graphics 6

    Cubic B-Splines

    We have talked about a bi-infinite set of splines.

    What does this look like?

    The unweighted B-Splines are shown for clarity. How does a weighted set affect the shape of the

    curve?

    t4 8 12

  • 7/27/2019 Lect28 Curves+Surfaces2

    7/27

    159.235 Graphics 7

    Generating a CurveX(t)

    t

    t

    Opposite we see an

    example of a shape to be

    generated.

    Here we see the curve

    again with the weightedB-Splines which

    generated the required

    shape.

  • 7/27/2019 Lect28 Curves+Surfaces2

    8/27

    159.235 Graphics 8

    B-Spline Example

    A closed curve is rather like a bi-infinite set

    a periodic set ofNknots in which:

    for all i, ti+N= ti and ti = i fori = 0..N-1

    Consider a closed curve with 5 control

    points with 5 knots. N=5, ie. x1 x4, etc.

    Control points are: x0 = (2,0); x1 = (1,1);x2 = (-1,1); x3 = (-1,-1) and x4 = (1,-1).

  • 7/27/2019 Lect28 Curves+Surfaces2

    9/27

    159.235 Graphics 9

    B-Spline Example

    Draw the interval: t = [4..5] , the others are handled the same way.

    11

    11

    11

    11

    0141

    0303

    0363

    1331

    6

    11)4()4()4()( 23 ttttX

    )0,1211(

    )32,32()5()32,32()4(

    )4664,664(6

    1

    ))4(4)4(6)4(64,)4(6)4(64(6

    1

    322

    322

    midwayand

    XandXHence

    ttttt

    or

    ttttt

    x0

    x1x2

    x3 x4

    x4

    x1

  • 7/27/2019 Lect28 Curves+Surfaces2

    10/27

    159.235 Graphics 10

    How Smooth is a B-Spine?

    Smoothness increases with orderkin Bi,k Quadratic, k= 3, gives up to C1 order continuity.

    Cubic, k= 4 gives up to C2 order continuity.

    However, we can lower continuity order too withMultiple Knots, ie.ti = ti+1= ti+2= Knots are coincident and so now we have non-

    uniform knot intervals.

    A knot with multiplicity m is continuous to the (k-1-m)th

    derivative.

    A knot with multiplicity khas no continuity at all, ie. the curve isbroken at that knot.

  • 7/27/2019 Lect28 Curves+Surfaces2

    11/27

    159.235 Graphics 11

    Non-Uniform Non-Rational B-Splines

    Note: as m increases by 1, an extra B-Splinefunction is attached to that knot: qiBi,k

    B-Splines have special forms at multiple knots. Obtained from a recursive formula defining how

    B-Splines are built, by setting m successive knotsto be equal: tk+1 = tk+2= = tk+m

    No point in having m>k Thus for endpoints to be on curve, they must have

    a multiplicity ofk, multiplicity of 4 in cubic case.

  • 7/27/2019 Lect28 Curves+Surfaces2

    12/27

    159.235 Graphics 12

    B-Splines at Multiple Knots

    The multiple-knot B-Splines are as follows:

    t

    B3,4(t)

    B0,4(t)

    B1,4(t) B2,4(t)

    i=0,1,2,3 4 5 6 7

    B0,4 is totally discontinuous at t = t0 , B1,4 is position continuous,

    B2,4 is gradient continuous, B3,4 is curvature continuous.

  • 7/27/2019 Lect28 Curves+Surfaces2

    13/27

    159.235 Graphics 13

    B-Spline Continuity Example

    First knot shown with 4control points, and their

    convex hull.

    P1

    P2P0

    P3

  • 7/27/2019 Lect28 Curves+Surfaces2

    14/27

    159.235 Graphics 14

    B-Spline Continuity Example

    First two curve segmentsshown with their respective

    convex hulls.

    Centre Knot must lie in the

    intersection of the 2 convexhulls.

    P1

    P2P0P4

    P3

  • 7/27/2019 Lect28 Curves+Surfaces2

    15/27

    159.235 Graphics 15

    Repeated Control Point

    First two curve segments

    shown with their respectiveconvex hulls.

    Knot is forced to lie on the

    line that joins the 2 convex

    hulls.

    Curve is only C1 continuous

    P1=P2

    P0P3

    P4

  • 7/27/2019 Lect28 Curves+Surfaces2

    16/27

    159.235 Graphics 16

    Triple Control Point

    First two curve segments

    shown with their respective

    convex hulls.

    Both convex hulls collapseto straight linesall the

    curve must lie on these lines.

    Curve is only C0 continuous

    (Curiously it is actually C2

    continuous because tangent

    vector magnitude falls to

    zero at join. )P1=P2=P3

    P0P4

  • 7/27/2019 Lect28 Curves+Surfaces2

    17/27

    159.235 Graphics 17

    Non-Uniform Non-Rational B-Splines

    Parametric interval between knots does not have to beequal.

    Blending functions no longer the same for each interval.

    Multiple knots may have to be spaced apart.

    Advantages

    Continuity at selected control points can be reduced toC1 or lowerallows us to interpolate a control point

    without side-effects. Can interpolate start and end points.

    Easy to add extra knots and control points.

  • 7/27/2019 Lect28 Curves+Surfaces2

    18/27

    159.235 Graphics 18

    Summary of B-Splines Functions that can interpolate a series of control points with C

    2

    continuity and local control.

    Dont pass through their control points, although can be forced.

    note that if an orderkB-Spline has kpoints locally colinear then a

    straight-line section will result midway in the set, and will touch

    (tangentially) the convex hull for (k1) colinear control points.

    Uniform

    Knots are equally spaced in t.

    Non-Uniform

    Knots are unequally spaced

    Allows addition of extra control points anywhere in the set.

  • 7/27/2019 Lect28 Curves+Surfaces2

    19/27

    159.235 Graphics 19

    B-Spline Summary Continued

    For interactive curve modelling B-Splines are very good.

    To interpolate a number of positions

    Catmull-Rom splines are best.

    To interpolate with tangent control Hemite or Bzier forms are useful and most often used.

    To draw a spline.

    Brute force method : Evaluate matrix to get parametric

    expressions for coordinates. Then for small increments oft, join with line segments.

    Better : use method of forward differences to expressspline in t form.

  • 7/27/2019 Lect28 Curves+Surfaces2

    20/27

    159.235 Graphics 20

    Surfacesa Simple Extension

    Easy to generalise from cubic curves to bicubicsurfaces.

    Surfaces defined by parametric equations of twovariables,s and t.

    ie. a surface is approximated by a series ofcrossing parametric cubic curves

    Result is a polygon mesh and decreasing step sizeins and twill give a mesh of small near-planarquadrilateral patches and more accuracy.

    1010 tands

  • 7/27/2019 Lect28 Curves+Surfaces2

    21/27

    159.235 Graphics 21

    Example Bzier surface

  • 7/27/2019 Lect28 Curves+Surfaces2

    22/27

    159.235 Graphics 22

    Control of Surface Shape

    Control is now a 2D array of control points.

    The two parameter surface function, forming the

    tensor product with the blending functions is:

    Use appropriate blending functions for Bzier and

    B-Spline surface functions. Convex Hull property is preserved since bicubic is

    still a weighted sum (1).

    ),(),(

    )()(),(

    tsZandtsYforsimilarly

    qtfsftsX ijjij

    i

  • 7/27/2019 Lect28 Curves+Surfaces2

    23/27

    159.235 Graphics 23

    Bzier Example

    Matrix formulation is as follows:

    coordszofarrayisq

    tMqMstsz

    coordsyofarrayisq

    tMqMstsy

    coordsxofarrayisq

    tMqMstsx

    z

    TBzB

    T

    y

    T

    ByB

    T

    x

    T

    BxB

    T

    44

    ....),(

    44

    ....),(

    44

    ....),(

    Substitute suitable values for

    s and t (20 in the above ex.)

  • 7/27/2019 Lect28 Curves+Surfaces2

    24/27

    159.235 Graphics 24

    B-Spline Surfaces

    Break surface into 4-sided patches choosing suitablevalues fors and t.

    Points on any external edges must be multiple knots ofmultiplicity k.

    Lot more work than Bzier.

    There are other types of spline systems and NURBSmodelling packages are available to make the work mucheasier.

    Use polygon packages for display, hidden-surface removaland rendering. (Bzier too)

  • 7/27/2019 Lect28 Curves+Surfaces2

    25/27

  • 7/27/2019 Lect28 Curves+Surfaces2

    26/27

    159.235 Graphics 26

    Displaying Bicubic Patches

    Can calculate surface normals to bicubic surfaces

    by vector cross product of the 2 tangent vectors.

    Normal is expensive to compute Formulation of normal is a biquintic (two-variable,fifth-

    degree) polynomial.

    Display.

    Can use brute-force methodvery expensive !

    Forward differencing method very attractive.

  • 7/27/2019 Lect28 Curves+Surfaces2

    27/27

    159.235 Graphics 27

    Curves & Surfaces II - Summary

    Bezier Curves

    Bicubic patches

    Acknowledgments - thanks to Eric McKenzie, Edinburgh, from whose

    Graphics Course some of these slides were adapted.