computer graphics representing curves and surfaces

Post on 05-Jan-2016

221 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Computer Graphics

Representing Curves and Surfaces

Revieweq(11.5)

zzzz

yyyy

xxxx

dtctbtatz

dtctbtaty

dtctbtatx

t

tztytxtQ

23

23

23

)(

)(

)(

10

)()()()(

Review eq(11.6/11.7)

zyx

zyx

zyx

zyx

ddd

ccc

bbb

aaa

ttt

CT

tztytxtQ

1

)()()()(

23

Review eq(11.8)

zzz

yyy

xxx

ctbtatz

ctbtaty

ctbtatx

tztytx

tzdt

dty

dt

dtx

dt

dtQtQ

dt

d

23)('

23)('

23)('

)(')(')('

)()()()(')(

2

2

2

Review eq(11.8)

zzzyyyxxx ctbtactbtactbta

CttCTdt

d

tzdt

dty

dt

dtx

dt

dtQtQ

dt

d

232323

0123

)()()()(')(

222

2

Review eq(11.9)

zyx

zyx

zyx

zyx

ggg

ggg

ggg

ggg

G

G

G

G

G

G

G

G

mmmm

mmmm

mmmm

mmmm

ttt

GMTtztytxtQ

444

333

222

111

4

3

2

1

4

3

2

1

44434241

34333231

24232221

14131211

23 1

)()()()(

Review eq(11.10)

z

z

z

z

y

y

y

y

x

x

x

x

gmtmtmtm

gmtmtmtm

gmtmtmtm

gmtmtmtmtz

gmtmtmtm

gmtmtmtm

gmtmtmtm

gmtmtmtmty

gmtmtmtm

gmtmtmtm

gmtmtmtm

gmtmtmtmtx

444342

243

14

343332

233

13

242322

223

12

141312

213

11

444342

243

14

343332

233

13

242322

223

12

141312

213

11

444342

243

14

343332

233

13

242322

223

12

141312

213

11

)(

)(

)(

)()(

)(

)(

)(

)()(

)(

)(

)(

)()(

Review

Blending function (also called ‘Basis’ function)

MTB

Hermite Curves

以曲線端點 P1.P4以及端點斜率 R1.R4

求曲線方程式

Hermite Curveseq(11.12)

zyx

zyx

zyx

zyx

H

RRR

RRR

PPP

PPP

R

R

P

P

G

GMTtztytxtQ

444

111

444

111

4

1

4

1

)()()()(

Hermite Curveseq(11.13)

zz

yy

xx

HHHH

zzzz

HHHH

yyyy

HHHH

xxxx

HH

GMtttGMT

dtctbtatz

GMtttGMT

dtctbtaty

GMtttGMT

dtctbtatx

GMTtztytxtQ

1

)(

1

)(

1

)(

)()()()(

23

23

23

23

23

23

Hermite Curveseq(11.14)

HH

HHz

HHy

HHx

GMPQ

GMPz

GMPy

GMPx

z

y

x

1000)0(

1000)0(

1000)0(

1000)0(

1

1

1

1

Hermite Curveseq(11.15)

HH

HHz

HHy

HHx

GMPQ

GMPz

GMPy

GMPx

z

y

x

1111)1(

1111)1(

1111)1(

1111)1(

4

4

4

4

Hermite Curves

zz

yy

xx

HHHH

zzz

HHHH

yyy

HHHH

xxx

HH

GMttGMTdt

d

ctbtatz

GMttGMTdt

d

ctbtaty

GMttGMTdt

d

ctbtatx

GMTdt

dtztytxtQtQ

dt

d

0123

23)('

0123

23)('

0123

23)('

)(')(')(')(')(

2

2

2

2

2

2

Hermite Curveseq(11.16)

HH

HHz

HHy

HHx

GMRQ

GMRz

GMRy

GMRx

z

y

x

0100)0('

0100)0('

0100)0('

0100)0('

1

1

1

1

Hermite Curveseq(11.17)

HH

HHz

HHy

HHx

GMRQ

GMRz

GMRy

GMRx

z

y

x

0123)1('

0123)1('

0123)1('

0123)1('

4

4

4

4

Hermite Curveseq(11.18)

HHH GMG

R

R

P

P

0123

0100

1111

1000

4

1

4

1

Hermite Curveseq(11.19)

0001

0100

1233

1122

HM

Hermite Curveseq(11.20)

zyx

zyx

zyx

zyx

HH

RRR

RRR

PPP

PPP

ttt

GMTtztytxtQ

444

111

444

111

23

0001

0100

1233

1122

1

)()()()(

Hermite Curveseq(11.21)

423

123

423

123

4

1

4

1

23232323

23

)()2()32()132(

232132

0001

0100

1233

1122

1

)(

RttRtttPttPtt

R

R

P

P

ttttttttt

Gttt

GBGMTtQ

H

HHHH

Hermite Curve

23232323 232132 tttttttttBH

Hermite Curveeq(11.22)

1,

0,

,

1

1

7

4

7

4

2

4

1

4

1

1

kcontinuityC

kcontinuityG

R

kR

P

P

G

R

R

P

P

G HH

Hermite Curveeq(11.23)

Reduce 6 multiplies and 3 additions to 3 multiplies and 3 additions.

dtctbat

dctbtattf

))((

)( 23

Bezier Curves

以曲線端點 P1.P4以及控制點 P2.P3

求曲線方程式曲線端點斜率為

)(3)1('

)(3)0('

344

121

PPQR

PPQR

Bezier Curveseq(11.24)

3

)0,3(

)0,3(),0,2(),0,1(),0,0(

)(

)(

4114

4321

344

121

RRPP

PPPP

PPR

PPR

Bezier Curveseq(11.25)

4

3

2

1

P

P

P

P

GB

Bezier Curveseq(11.26)

BHBH GM

P

P

P

P

R

R

P

P

G

PPR

PPR

4

3

2

1

4

1

4

1

344

121

3300

0033

1000

0001

)(3

)(3

Bezier Curveseq(11.27/11.28)

0001

0033

0363

1331

3300

0033

1000

0001

0001

0100

1233

1122

)(

)(

)(

HBHB

BB

BHBH

BHBH

HH

MMM

GMT

GMMT

GMMT

GMTtQ

Bezier Curveseq(11.29)

43

32

22

13

444

333

222

111

23

)1(3)1(3)1(

0001

0033

0363

1331

1

)(

PtPttPttPt

PPP

PPP

PPP

PPP

ttt

GBGMTtQ

zyx

zyx

zyx

zyx

BBBB

Bezier Curves 3223

3232323

)1(3)1(3)1(

33363133

tttttt

tttttttttBB

Bezier Curves

Define n as the order of Bezier curves.Define i as control point.

inin

i

n

iini

inini

tuinC

PtBtQ

knk

nknC

ttinCtB

)1(),(

)()(

)!(!

!),(

)1(),()(

0

0,

,

Bezier Curves

33333,3

22323,2

21313,1

30303,0

)1(!0!3

!3)(

)1(3)1(!1!2

!3)(

)1(3)1(!2!1

!3)(

)1()1(!3!0

!3)(

ttttB

tttttB

tttttB

ttttB

Bezier Curves

BB GMT

P

P

P

P

ttt

P

P

P

P

tttttt

PtPttPttPttQ

0001

0033

0363

1331

1

)1(3)1(3)1(

)1(3)1(3)1()(

3

2

1

0

23

3

2

1

0

3223

33

22

12

03

Bezier Curves

De Casteljau iterations

],0[

],1[

)1( 11

1

jni

nj

tPPtP ji

ji

ji

Bezier Curves

Linear Bezier splinesControl points: P0, P1

10

)1()()( 10010

t

tPPttPPPtP

Bezier Curves

Quadratic Bezier splinesControl points: P0, P1, P2

10

)1()(

)1()(

211211

1

100101

0

t

tPPttPPPP

tPPttPPPP

Bezier Curves

Quadratic Bezier splinesControl points: P0, P1, P2

2

210

2

2110

11

10

10

11

10

)1(2)1(

)1()1()1(

)1(

)()(

PtPttPt

tPPtttPPtt

tPPt

tPPPtP

Bezier Curves

Cubic Bezier splinesControl points: P0, P1, P2, P3

322321

2

211211

1

100101

0

)1()(

)1()(

)1()(

tPPttPPPP

tPPttPPPP

tPPttPPPP

Bezier Curves

Cubic Bezier splinesControl points: P0, P1, P2, P3

3

221

2

3221

12

11

11

12

11

21

22

102

2110

11

10

10

11

10

20

)1(2)1(

)1()1()1(

)1()(

)1(2)1(

)1()1()1(

)1()(

PtPttPt

tPPtttPPtt

tPPttPPPP

PtPttPt

tPPtttPPtt

tPPttPPPP

Bezier Curves

Cubic Bezier splinesControl points: P0, P1, P2, P3

33

22

12

03

32

212

22

102

21

20

20

21

20

)1(3)1(3)1(

)1(2)1(

)1(2)1()1(

)1(

)()(

PtPttPttPt

PtPttPtt

PtPttPtt

tPPt

tPPPtP

Bezier Curves

BB

zyx

zyx

zyx

zyx

GMT

PPP

PPP

PPP

PPP

ttt

P

P

P

P

tttttt

PtPttPttPttP

0001

0033

0363

1331

1

)1(3)1(3)1(

)1(3)1(3)1()(

333

222

111

000

23

3

2

1

0

3223

33

22

12

03

Bezier Curves

http://www.ibiblio.org/e-notes/Splines/Bezier.htm

Spline

Natural cubic splineC0, C1, C2 continuous.Interpolates(passes through) the control points.Moving any one control point affects the entire curve.

Spline

B-splineLocal control.Moving a control point affects only a small part of a curve.Do not interpolate their control points.Sharing control points between segments.

B-spline

m+1 control points P0, …, Pm, m≥3m-2 curve segments Q3, Q4, …, Qm

For each i≥4, there is a join point or knot between Qi-1 and Qi at the parameter value ti.

B-splineeq(11.43/11.44)

)()(

)()()(

)()()(

,0)(

,1)(

4,4,11

4,224,33

1,11

1,1

,

1,

11,

tBPtBP

tBPtBPtQ

tBtt

tttB

tt

tttB

otherwisetB

ttttB

iiii

iiiii

diidi

didi

idi

idi

i

iii

B-splineeq(11.44)

)()()(

)()()(

)()()(

3,114

43,

34,

2,113

32,

23,

1,112

21,

12,

tBtt

tttB

tt

tttB

tBtt

tttB

tt

tttB

tBtt

tttB

tt

tttB

iii

ii

ii

ii

iii

ii

ii

ii

iii

ii

ii

ii

Uniform Nonrational B-spline

‘Uniform’ means that the knots are spaced at equal intervals of the parameter t.‘Nonrational’ is used to distinguish these splines from rational cubic polynomial curves, see Section 11.2.5We assume that t3=0 and the interval ti+1-ti=1

Uniform Nonrational B-spline

eq(11.32/11.33/11.34)

0141

0303

0363

1331

6

1

3,

,)(

1

2

3

1

Bs

i

i

i

i

B

iiBBSii

M

mi

P

P

P

P

G

tttGMTtQ

Si

Si

Uniform Nonrational B-spline

eq(11.35)

.10,1333463)1(6

1

13334631336

1

323233

3232323

123 0

tttttttt

ttttttttt

BBBBMTB BsBsBsBsBsBs

Uniform Nonrational B-spline

eq(11.36)

iiii

iBiBiBiBBsBs

BsBsii

Pt

Pttt

Ptt

Pt

PBPBPBPBGB

GMTtQ

SSSSi

i

66

1333

6

463

6

)1(

)(

3

1

23

2

23

3

3

123 0123

1 ii ttt

Uniform Nonrational B-spline

eq(11.37)

)()(

)()(

)()(

112

2

12

2

111

111

iiii

iiii

iiii

txdt

dtx

dt

d

txdt

dtx

dt

d

txtx

Uniform Nonrational B-spline

eq(11.38)

012

2

12

2

011

011

1

1

1

||

||

||

ii

ii

ii

ttitti

ttitti

ttitti

xdt

dx

dt

d

xdt

dx

dt

d

xx

Uniform Nonrational B-spline

iiii

iiiiii

iiiiii

iiiiii

tPPtPtPt

Pt

Pt

Pt

Pt

ttQ

Pt

Ptt

Ptt

Ptt

ttQ

Pt

Pttt

Ptt

Pttt

ttQ

123

123

2

1

2

2

2

3

2

3

1

23

2

23

3

32

)13()23()1( 6

6

6

618

6

1218

6

66)(''

6

3

6

369

6

129

6

363)('

66

1333

6

463

6

331)(

Uniform Nonrational B-spline

112

11211

1

22

1

2

2

2

11

1

323

1

23

2

32

11

)13()23()1( 6

6

6

618

6

1218

6

66)(''

6

3

6

369

6

129

6

363)('

66

1333

6

463

6

331)(

iiii

iiiiii

iiiiii

iiiiii

tPPtPtPt

Pt

Pt

Pt

Pt

ttQ

Pt

Ptt

Ptt

Ptt

ttQ

Pt

Pttt

Ptt

Pttt

ttQ

Uniform Nonrational B-spline

eq(11.39/11.40/11.41)

xxxii

xx

ii

xxx

ii

iiiiittitti

iiiittitti

iii

iittitti

PPPQQxdt

dx

dt

d

PPQQx

dt

dx

dt

d

PPPQQxx

121012

2

12

2

21011

12

1011

2)0()1(||

2)0()1(||

6

4)0()1(||

1

1

1

Uniform Nonrational B-spline

eq(11.42)The curve can be forced to be interpolate specific points by replicating control points.

iBsBsBsiBsi

iii

PBBBPBtQ

PPP

)()(

,

01233

12

Nonuniform Nonrational B-spline

Parameter interval between successive knot values need not be uniform.Blending functions are no longer the same for each interval.Continuity at selected join points can be reduced from C2 to C1 to C0 to none.

When the curve is C0, the curve interpolates a control point.

Nonuniform NonrationalB-spline

If the continuity is reduced to C0, then the curve interpolates a control point, but without the undesirable effect of uniform B-splines, where the curve segments on either side of the interpolated control point are straight lines.

Nonuniform NonrationalB-spline

m+1 control points P0, P1, …, Pm

nondecreasing sequence of knot valuest0, t1, …, tm+4

Nonuniform NonrationalB-spline

Nonuniform Rational Cubic Polynomial Curve

)()()()()(

)(

)()(,

)(

)()(,

)(

)()(

tWtZtYtXtQ

tW

tZtz

tW

tYty

tW

tXtx

Nonuniform Rational Cubic Polynomial CurveAdvantages

They are invariant under rotation, scaling, translation and perspective transformations of the control points.They can define precisely and of the conic sections.

Catmull-Rom spline

132

021

212

1

PPR

PPR

Catmull-Rom spline

0020

0101

1452

1331

21

1010

0101

0200

0020

0001

0100

1233

1122

21

2102

10

02102

10100

0010

4

3

2

1

4

1

4

1

HCHC

CHCH

MMM

GM

P

P

P

P

R

R

P

P

G

Catmull-Rom splineeq(11.47)

i

i

i

i

CCi

P

P

P

P

T

GMTQ

1

2

3

0020

0101

1452

1331

21

Subdividing Curves

Bezier Curve

2/)(

2/)(

2/)(

2/)(

2/)(

2/

2314

32

433

23

32

212

RLRL

RHR

PPR

HLL

PPH

PPL

Subdividing Curves

4

3

2

1

4

3

2

1

4

3

2

1

4

3

2

1

8000

4400

2420

1331

81

1331

0242

0044

0008

81

P

P

P

P

GD

R

R

R

R

G

P

P

P

P

GD

L

L

L

L

G

BRB

RB

BLB

LB

Subdividing Curves

Uniform B-spline CurveDoubling:Do k subdivision steps (for k-degree B-spline)

33221100 ,,,,,,, PPPPPPPP

2,

8

6,

2,

8

6,

2

4

3,

4

3,

4

3,

4

3,

4

3,

4

3

,2

,,2

,,2

,

323212121010

323221211010

332

221

110

0

PPPPPPPPPPPP

PPPPPPPPPPPP

PPP

PPP

PPP

P

Subdividing Curves

i

i

i

i

BSiSRBSi

RB

i

i

i

i

SiBSLBSi

LB

P

P

P

P

GDG

P

P

P

P

GDG

1

2

3

1

2

3

4400

1610

0440

0161

8

1

1610

0440

0161

0044

8

1

Conversioneq(11.56)

111

22221

2

1122

1122

GMMGGMM

GMGM

GMTGMT

Conversioneq(11.57/11.58)

BBBBsBs

BsBsBsBB

BsBsBB

GGMMG

GGMMG

GMTGMT

6720

0210

0120

0276

1410

0420

0240

0141

6

1

1

1

Drawing Curveseq(11.59/11.60/11.61)

)(,),(

)()()(

0),()()(

1 nnnnn tffntnfff

tftftf

tftftf

Drawing Curveseq(11.62/11.63)

cbbtaatat

dctbtatdtc

ttbttta

dctbtatdtctbta

tftftf

dctbtattf

2322

23

223223

2323

23

233

)(])(

)2()33([

)(])()()([

)()()(

)(

Drawing Curveseq(11.64/11.65/11.66/11.6

7)

12

1

12

232

2222

2322

2322

2

266

)23(3)2(3

])23(3[

])23)(()(3[

)()())(()(

nnn

nnn

fff

fff

baat

baattta

cbabatat

cbabatta

tftftftf

Drawing Curveseq(11.68/11.69/11.70)

32

21

2

32321

2

3

22

22

23

6

6

6

6)(6

)()(

))(()(

aff

affff

a

tata

tftf

tftf

nn

nnnn

Drawing Curveseq(11.71/11.72)

d

c

b

a

f

f

f

f

D

af

baf

cbaf

df

t

0006

0026

0

1000

6

26

0

3

23

23

03

02

0

0

30

3

230

2

230

0

Comparison

Parametric Bicubic Surfaceseq(11.73)

)(

)(

)(

)(

)(),(

)(

)(

4

3

2

1

tG

tG

tG

tG

MStGMStsQ

GMSsQ

GMTtQ

Parametric Bicubic Surfaces

TT

iiiiT

i

Tiiii

i

i

i

i

ii

TMggggtG

ggggMT

g

g

g

g

MTGMTtG

4321

4321

4

3

2

1

)(

)(

Parametric Bicubic Surfaces

eq(11.74/11.75)

.1,0,

),(

44434241

34333231

24232221

14131211

tsTMGMS

TM

gggg

gggg

gggg

gggg

MStsQ

TT

TT

Parametric Bicubic Surfaceseq(11.76)

TTz

TTy

TTx

TMGMStsz

TMGMStsy

TMGMStsx

),(

),(

),(

Hermite Surfaceseq(11.77)

x

H

HH

tR

tR

tP

tP

MS

tGMStsxx

)(

)(

)(

)(

)(),(

4

1

4

1

Hermite Surfaces

Hermite Surfaceseq(11.78)

x

Hx

x

Hx

x

Hx

x

Hx

g

g

g

g

MTtR

g

g

g

g

MTtR

g

g

g

g

MTtP

g

g

g

g

MTtP

44

43

42

41

4

34

33

32

31

1

24

23

22

21

4

14

13

12

11

1

)(,)(

)(,)(

Hermite Surfaceseq(11.79/11.80/11.81)

TTHH

TTH

x

x

H

THHx

TMGTM

gggg

gggg

gggg

gggg

tR

tR

tP

tP

gggg

gggg

gggg

gggg

G

GMTtRtRtPtP

x

x

x

44434241

34333231

24232221

14131211

4

1

4

1

44434241

34333231

24232221

14131211

4141

)(

)(

)(

)(

)()()()(

Hermite Surfaceseq(11.82/11.83)

TTHHH

TTHHH

TTHHH

TTHHH

TMGMStsQ

TMGMStsz

TMGMStsy

TMGMStsx

z

y

x

),(

),(

),(

),(

Hermite Surfaceseq(11.84)

)1,1()0,1()1,1()0,1(

)1,0()0,0()1,0()0,0(

)1,1()0,1()1,1()0,1(

)1,0()0,0()1,0()0,0(

22

22

xts

xts

xs

xs

xts

xts

xs

xs

xt

xt

xx

xt

xt

xx

GxH

Hermite Surfaces

0,2

1

44434241

24232221

44434241

24232221

kkgkgkgkg

gggg

Patch

gggg

ggggPatch

Normals to Surfaceseq(11.88/11.89)

TT

TT

TT

TT

TT

TT

ttMGMS

Tt

MGMS

TMGMSt

tsQt

TMGMss

TMGMSs

TMGMSs

tsQs

0123

)(

)(),(

0123

)(

)(),(

2

2

Normals to Surfaceseq(11.90)

sttssttsstts

ttt

sss

yxyxxzxzzyzytsQt

tsQs

zyxtsQt

zyxtsQs

),(),(

),,(),(

),,(),(

top related