Top Banner
Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012
19

Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

Jan 19, 2016

Download

Documents

Ashlyn Logan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

Bezier and Spline Curves and Surfaces

Ed Angel

Professor Emeritus of Computer Science

University of New Mexico

1E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Page 2: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

2E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Objectives

• Introduce the Bezier curves and surfaces•Derive the required matrices• Introduce the B-spline and compare it to the standard cubic Bezier

Page 3: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

3E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Bezier’s Idea

• In graphics and CAD, we do not usually have derivative data

•Bezier suggested using the same 4 data points as with the cubic interpolating curve to approximate the derivatives in the Hermite form

Page 4: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

4E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Approximating Derivatives

p0

p1p2

p3

p1 located at u=1/3 p2 located at u=2/3

3/1

pp)0('p 01

3/1

pp)1('p 23

slope p’(0) slope p’(1)

u

Page 5: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

5E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Equations

p(0) = p0 = c0

p(1) = p3 = c0+c1+c2+c3

p’(0) = 3(p1- p0) = c0

p’(1) = 3(p3- p2) = c1+2c2+3c3

Interpolating conditions are the same

Approximating derivative conditions

Solve four linear equations for c=MBp

Page 6: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

6E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Bezier Matrix

1331

0363

0033

0001

MB

p(u) = uTMBp = b(u)Tp

blending functions

Page 7: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

7E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Blending Functions

b(u) =

3(1− u)

3u 2(1− u)

3 2u (1− u)3u

⎢ ⎢ ⎢ ⎢

⎥ ⎥ ⎥ ⎥

Note that all zeros are at 0 and 1 which forcesthe functions to be smooth over (0,1)

Page 8: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

8E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Bernstein Polynomials

•The blending functions are a special case of the Bernstein polynomials

•These polynomials give the blending polynomials for any degree Bezier form

All zeros at 0 and 1

For any degree they all sum to 1

They are all between 0 and 1 inside (0,1)

)1()!(!

!)(kd uu

kdk

dub

kdk

Page 9: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

9E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Convex Hull Property

• The properties of the Bernstein polynomials ensure that all Bezier curves lie in the convex hull of their control points

• Hence, even though we do not interpolate all the data, we cannot be too far away

p0

p1 p2

p3

convex hull

Bezier curve

Page 10: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

10E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Bezier Patches

Using same data array P=[pij] as with interpolating form

vupvbubvup TBB

Tijj

i ji MPM

)()(),(3

0

3

0

Patch lies inconvex hull

Page 11: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

11E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Analysis

• Although the Bezier form is much better than the interpolating form, we have the derivatives are not continuous at join points

• Can we do better? Go to higher order Bezier

• More work• Derivative continuity still only approximate• Supported by OpenGL

Apply different conditions • Tricky without letting order increase

Page 12: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

12E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

B-Splines

• Basis splines: use the data at p=[pi-2 pi-1 pi pi-1]T to define curve only between pi-1 and pi

• Allows us to apply more continuity conditions to each segment

• For cubics, we can have continuity of function, first and second derivatives at join points

• Cost is 3 times as much work for curves Add one new point each time rather than three

• For surfaces, we do 9 times as much work

Page 13: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

13E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Cubic B-spline

1331

0363

0303

0141

MS

p(u) = uTMSp = b(u)Tp

Page 14: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

14E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Blending Functions

u

uuuuu

u

u

3

22

32

3

3331

364

)1(

6

1)(b

convex hull property

Page 15: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

15E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

B-Spline Patches

vupvbubvup TSS

Tijj

i ji MPM

)()(),(3

0

3

0

defined over only 1/9 of region

Page 16: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

16E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Splines and Basis

• If we examine the cubic B-spline from the perspective of each control (data) point, each interior point contributes (through the blending functions) to four segments

•We can rewrite p(u) in terms of the data points as

defining the basis functions {Bi(u)}

puBup ii )()(

Page 17: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

17E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Basis Functions

2

21

11

12

2

0

)1(

)()1(

)2(

0

)(

3

2

1

0

iu

iui

iuiiui

iui

iu

ub

ubub

ub

uBi

In terms of the blending polynomials

Page 18: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

18E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Generalizing Splines

•We can extend to splines of any degree •Data and conditions to not have to given at equally spaced values (the knots)

Nonuniform and uniform splines

Can have repeated knots• Can force spline to interpolate points

•Cox-deBoor recursion gives method of evaluation

Page 19: Bezier and Spline Curves and Surfaces Ed Angel Professor Emeritus of Computer Science University of New Mexico 1 E. Angel and D. Shreiner: Interactive.

19E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

NURBS

•Nonuniform Rational B-Spline curves and surfaces add a fourth variable w to x,y,z

Can interpret as weight to give more importance to some control data

Can also interpret as moving to homogeneous coordinate

•Requires a perspective division NURBS act correctly for perspective viewing

•Quadrics are a special case of NURBS