8
27 October 1999 CS 318 - Computer Graphics (Top Changwatchai) Slide 1 Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D or 3D Control points Interpolation vs. approximation Convex hull Continuity conditions Local vs. global control Three methods of specifying splines Types of splines – Cubic – Bézier – B-splines – Other

Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

Embed Size (px)

Citation preview

Page 1: Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

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

Review of Spline Concepts• Sections 10-6 to 10-13 in Hearn & Baker• Splines can be 2D or 3D• Control points• Interpolation vs. approximation• Convex hull• Continuity conditions• Local vs. global control• Three methods of specifying splines• Types of splines

– Cubic– Bézier– B-splines– Other

Page 2: Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

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

Spline Basics (1/3)• Definitions

– Textbook calls a spline curve “any composite curve formed with polynomial sections satisfying specified continuity conditions at the boundary of the pieces” - can be 2D or 3D

– Spline surfaces formed 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 any control point

• Convex hull– minimum convex polygon boundary that encloses set of

control points

Page 3: Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

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

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 (1st derivatives) equal• C2 - 1st and 2nd derivatives 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 G1 continuity without C1 continuity

• Local vs. global control– Global control - if one point altered, the entire curve affected– Local control - only that curve section is affected

Page 4: Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

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

Spline Basics (3/3)• Recall from previous slide

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

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

= U Mspline Mgeom

= B Mgeom

– U is the 14 parameter vector– Co is the 41 coefficient matrix

• Three methods of spline specification– Boundary conditions

• Description given in English

• Actual values placed in 41 geometry vector Mgeom

– Basis matrix• Mspline is the 44 basis matrix

• This is constant for a given type of spline

• Co = Mspline Mgeom

– Blending functions• B is a 14 matrix representing the blending functions

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

Page 5: Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

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

Types of Splines• Why cubic?

– Higher order less stable, more complex to calculate– Lower order don’t 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

• Bézier (approximation)• B-splines (approximation)• Other

Page 6: Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

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

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

Page 7: Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

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

Bézier Curves - Features

• Approximation• Global control• Number of control points determines degree of Bézier

curve• Easy to implement and calculate recursively• Always passes through first and last control points• Lies within convex hull• Easy to connect sections together

Page 8: Slide 127 October 1999CS 318 - Computer Graphics (Top Changwatchai) Review of Spline Concepts Sections 10-6 to 10-13 in Hearn & Baker Splines can be 2D

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

Note from 27 October lecture

In class we went over how to derive the following boundary conditions from the definition of Bézier 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 u and 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 u’s 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

knkk uBEZu

0, )(p)(P

nn

nn

nn

nnn un

nuu

n

nuu

n

nuu

nuu

nu

nu

p)1(

1p)1(

2p)1(

2p)1(

1p)1(

0p)(P 1

122

222

21

10

1121

2232

3222

211

10

p)1()1)(1(1

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

p

)2()1()1(22

p)1()1()1(1

p)()1(0

p)(P'

nn

nnn

nnn

nnnnn

nun

nunuu

n

nuunuu

n

n

nuuuun

nuuun

nun

u

0p)0(P 0

n

n

nnp)1(P

1p)(

0p)0(P' 10

nn

nn

n

n

n

nnn

p)1(1

p)1(P' 1