Upload
brittney-welch
View
219
Download
0
Tags:
Embed Size (px)
Citation preview
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
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)
4
Tangent line to curve
)(')()(
:)( curve to)( lineTangent
tsts
ts
ppq
pq
t
p(t) p’(t)
s
q(s)
5
Example
]cossin,sin[cos
)(')()(
]cos,sin[)('
]sin,[cos)(
tsttst
tsts
ttt
ttt
ppq
p
p
tp(t)
p’(t)
sq(s)
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.
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?
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
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
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
11
Linear interpolation
• Not Smooth
• Local control
• Intuitive and easy to use
• Interpolate
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
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
14
Lagrangian interpolation - 3
15
Lagrangian interpolation - 4
• Smooth– no discontinuities in direction and curvature;
• NO local control
• Wild oscillations, not variation diminishing!
• Interpolating
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
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)
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
19
Bézier curve - 4
.
)1(!)!(
!)(
with,10 ,)()(
:points 1
,
0,
iinNi
i
N
iNi
ttiiN
NtB
ttBt
N
pp
20
Bézier curve - 5
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
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
23
Convex hull property example
Curve outside
convex hull
Curve inside
convex hull
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
25
Quadratic B-spline
26
Cubic B-spline
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
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,...
29
Cubic splines - 2
tyy/simpliciflexibilit compromise
)( :
control local
zero-nonlocally only )(:
:splines cubic Piecewise
23 dctbtattwCubic
twPiecewise
i
i
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
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
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)
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)
34
Cubic Bézier curve
p0
p1 p2
p3
35
Joining two Bezier segments
p0
p2
p3q0
q2
q3
Positional continuity:
p3 = q0
Tangential continuity:
p3- p2 // q1- q0
p1
q1
36
Cubic B-spline curve
p0 p3
p1 p2
37
Conversion - 1
38
Conversion - 2
39
Puzzle 1: Hermite spline
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.
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
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
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