1 introduction curve modelling jack van wijk tu eindhoven

43
1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

Upload: brittney-welch

Post on 18-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

1

Introduction Curve Modelling

Jack van Wijk

TU Eindhoven

Page 2: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

2

Overview curve modelling

• Parametric curves

• Requirements

• Concepts

• Lagrangian interpolation

• Bézier curve

• B-spline

• Cubic splines

Page 3: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

3

Parametric curves

ttpttp

tptpt

tptpt

yx

yx

yx

d/)('d,d/)(d

)('),(')('

:curve ctor toTangent ve

)(),()(

:curve Parametric

p

pt

p(t) p’(t)

Page 4: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

4

Tangent line to curve

)(')()(

:)( curve to)( lineTangent

tsts

ts

ppq

pq

t

p(t) p’(t)

s

q(s)

Page 5: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

5

Example

]cossin,sin[cos

)(')()(

]cos,sin[)('

]sin,[cos)(

tsttst

tsts

ttt

ttt

ppq

p

p

tp(t)

p’(t)

sq(s)

Page 6: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

6

Curve modelling

• Problem: How to define a smooth curve?

• Solution:– Specify a sequence of points pi , i = 1,…, N,

(control-points);– Generate a smooth curve that interpolates or

approximates these control-points.

Page 7: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

7

Requirements

• Smooth– no discontinuities in direction and curvature;

• Local control– Change of a point should have only local effect;

• Intuitive and easy to use– no oscillations, variation diminishing

• Approximate or interpolate?

Page 8: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

8

Parametric interpolation

1)(

:)(on t Requiremen

points.-control theof average weighted:Curve

.point for function or theis )(

,)()(

:formula Standard

1

1

N

ii

i

ii

i

N

ii

tw

tw

blendingweightingtw

twt

p

pp

Page 9: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

9

Linear interpolation of two points

p1

p2t

.)(

and ,1)(

with,)()(

or ,)1()(

2

1

2

1

21

ttw

ttw

twt

ttt

ii

i

pp

ppp

Page 10: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

10

Linear interpolation of N points

p1

p2t

otherwise0

1 if1

1 if1

)(

with,1 ,)()(1

ititi

itiit

tw

Nttwt

i

i

N

ii pp

p3

p4p5

t

wi

1 2 3 4 5

1

0

Page 11: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

11

Linear interpolation

• Not Smooth

• Local control

• Intuitive and easy to use

• Interpolate

Page 12: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

12

Lagrangian interpolation - 1

.points theesinterpolat )( i.e. ,)(then

if0

if1)(

If .,...,2,1Let

ed?interpolat all are points-control the

such that )( spolynomial find can we

,1 ,)()(Given 1

tk

ik

ikkw

Nk

tw

Nttwt

k

i

i

i

i

N

ii

ppp

p

pp

Page 13: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

13

Lagrangian interpolation - 2

42

13

2

3

6

1

)41)(31)(21(

)4)(3)(2()(

:4Nfor Example

if0

if1)( satisfies

)( :polynomial Lagrange

231

tttttt

tw

ik

ikkw

ji

jttw

i

iji

Page 14: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

14

Lagrangian interpolation - 3

Page 15: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

15

Lagrangian interpolation - 4

• Smooth– no discontinuities in direction and curvature;

• NO local control

• Wild oscillations, not variation diminishing!

• Interpolating

Page 16: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

16

Bézier curve - 1

• Puzzle: Define a smooth curve that interpolates the first and last point and approximates the others.

p1

p2

p3

p4

Page 17: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

17

Bézier curve - 2

• Solution for N=3:

p1

p2

p3

q2

q1

32

212

3221

21

322

211

)1(2)1(

))1(())1)((1(

)()()1()(

)1()(

)1()(

ppp

pppp

qqp

ppq

ppq

tttt

tttttt

ttttt

ttt

ttt

p(t)

Page 18: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

18

Bézier curve - 3

• Solution for N=4:

p1

p2 p3

43

32

22

13 )1(3)1(3)1()( ppppp ttttttt

p(t)

p4

Page 19: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

19

Bézier curve - 4

.

)1(!)!(

!)(

with,10 ,)()(

:points 1

,

0,

iinNi

i

N

iNi

ttiiN

NtB

ttBt

N

pp

Page 20: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

20

Bézier curve - 5

Page 21: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

21

Bézier curve - 6

General Bézier curve:• Degree = #points-1• Smooth

– no discontinuities in direction and curvature;

• NO local control• Variation diminishing, convex hull property• Interpolates first and last, further

approximating

Page 22: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

22

Convex hull property

0)(

and 1)(

:if points control of hullconvex within lies Curve

points. all containsat polygon thconvex

smallest :points ofset a of hullConvex

i

tw

tw

i

i

Page 23: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

23

Convex hull property example

Curve outside

convex hull

Curve inside

convex hull

Page 24: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

24

B-splines

• Piecewise polynomial, locally non-zero

• Degree: user definable

• Continuity: degree-1– first degree: continuous in position– second degree: continuous in tangent– third degree: continuous in curvature

Page 25: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

25

Quadratic B-spline

Page 26: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

26

Cubic B-spline

Page 27: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

27

B-splines - 3

General B-spline:

• Degree: from 1 to N-1

• Smooth (if degree > 1)

• Local control

• Variation diminishing, convex hull property

• Approximating

Page 28: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

28

Cubic splines - 1

Most popular in Computer Graphics:• powerful

– inflection points, continuity

• simple– low degree polynomials

• local control• Many versions:

– Bézier, B-spline, Catmull-Rom,...

Page 29: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

29

Cubic splines - 2

tyy/simpliciflexibilit compromise

)( :

control local

zero-nonlocally only )(:

:splines cubic Piecewise

23 dctbtattwCubic

twPiecewise

i

i

Page 30: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

30

Cubic splines - 2

segment. curve theof properties thedefines matrix The

1)(

or ,)(

:pointsfour by controlled,10 ),(segment Curve

3

2

1

0

4,43,42,41,4

4,33,32,31,3

4,23,22,21,2

4,13,12,11,1

23

M

mmmm

mmmm

mmmm

mmmm

tttt

TMGt

tt

p

p

p

p

p

p

p

Page 31: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

31

Cubic splines - 3

34,43,42,42

1,43

24,33,32,32

1,33

14,23,22,22

1,23

04,13,12,12

1,13

)(

)(

)(

)()(

:outwritten ,10 ),(segment Curve

p

p

p

pp

p

mtmmtmt

mtmmtmt

mtmmtmt

mtmmtmtt

tt

Page 32: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

32

Tangent vector

3

2

1

0

4,43,42,41,4

4,33,32,31,3

4,23,22,21,2

4,13,12,11,1

2 0123)('

:)( alongctor tangent ve:)('

p

p

p

p

p

pp

mmmm

mmmm

mmmm

mmmm

ttt

tt

t

p’(t)p(t)

Page 33: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

33

Significant values

• p(0) : startpoint segment

• p’(0) : tangent through startpoint

• p(1) : endpoint segment

• p’(1) : tangent through endpoint

tp(0)

p(1)p’(0)

p’(1)

Page 34: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

34

Cubic Bézier curve

p0

p1 p2

p3

Page 35: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

35

Joining two Bezier segments

p0

p2

p3q0

q2

q3

Positional continuity:

p3 = q0

Tangential continuity:

p3- p2 // q1- q0

p1

q1

Page 36: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

36

Cubic B-spline curve

p0 p3

p1 p2

Page 37: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

37

Conversion - 1

Page 38: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

38

Conversion - 2

Page 39: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

39

Puzzle 1: Hermite spline

Page 40: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

40

Puzzle 2: Limit on interpolation

Find out why a curve that– interpolates the control points, – stays within the convex hull,– and is smooth

cannot exist, both graphically and

mathematically.

Page 41: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

41

Puzzle 3: Split Bezier curve

• Find a recipe to split a cubic Bezier curve segment into two segments:

p0

p2

p3 q0

q1

q6

p1 q2 q3 q4

q5

Page 42: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

42

Finally...

• Curves: interpolation of points– Interpolation is generally applicable, f.i.

surfaces: interpolation of curves

• Demo program:www.win.tue.nl/~vanwijk/2M050/spline.exe

Page 43: 1 Introduction Curve Modelling Jack van Wijk TU Eindhoven

43

B-splines - 2

d

tNti

d

tNdittN

ditditN

tN

dnttNt

dn

dididi

i

di

i

n

idi

)()1()()()(

otherwise0

1 if1)(

:yrecursivel defined )(

with,10 ,)()(

: degree points, 1 spline,-B Simple

1,11,,

0,

,

0,

pp