Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Hermite Curves
Introduction to 3rd-order curvesNov. 29th, 2016
Announcements• PA4 due today (at 3:00 J )• PA5 due in 1 week
– Ross has posted it to the web site– Adds reflection to PA4
12/1/16
© Bruce Draper & J. Ross Beveridge
2
Representing Curved Objects• So far we’ve seen
– Polygon Meshes, Spheres, a touch of CSG.
• Now, polynomial curves– Hermite curves– Bezier curves– B-Splines– NURBS
• Bivariate polynomial surface patches
12/1/16
© Bruce Draper & J. Ross Beveridge
3
Beyond linear approximation
12/1/16
© Bruce Draper & J. Ross Beveridge
4
Instead of approximating everything by zillions of lines and planes, it is possible to approximate shapes using higher-order curves. Advantages:
• More compact
• Reduces “artifacts”
Use of sphere in ray tracer is an example of an implicit curve.
The Pen Metaphore• Think of putting a pen to paper• Pen position described by time t
12/1/16
© Bruce Draper & J. Ross Beveridge
5
Seeing the action of drawing is the key, so this static drawing only partly captures the point of this slide.
Design Criteria• Local control of shape
• Smoothness and continuity
• Ability to evaluate derivatives
• Stability
• Ease of rendering
12/1/16
© Bruce Draper & J. Ross Beveridge
6
Review Forms - Explicit
• Explicit representation: y = f(x)
• Drawbacks:– Multiple values of y for a single x impossible.– Not rotationally invariant.
12/1/16
© Bruce Draper & J. Ross Beveridge
7
y = ax3 + bx2 + cx + d
Review Forms - Implicit• Implicit representation: f(x, y, z) = 0
• Advantages:– On curve & relative distance to curve tests.
• Drawbacks:– Enumerating points on the curve is hard.– Extra constraints needed – half a circle?– Difficult to express and test tangents.
12/1/16
© Bruce Draper & J. Ross Beveridge
8
x2
a2+y2
b2+z2
c2−1= 0
Parametric Representations
12/1/16
© Bruce Draper & J. Ross Beveridge
9
We will represent 3D curves using a parametric representation, introducing anew variable t:
Notethatx,yandzaredependentontalone,makingitclearthatthereisonlyonefreevariable.
Ausefulmetaphoristothinkoftastimeassociatedwithmovementalongthecurve.
Q t( ) = x t( ) y t( ) z t( )
Third Order Curves• Third-order functions are the standard:
• Why 3?– Lower-order curves cannot be smoothly joined.– Higher-order curves introduce “wiggles”.
• Without loss of generality: 0 <= t <= 1.
12/1/16
© Bruce Draper & J. Ross Beveridge
10
x t( ) = axt3 + bxt2 + cxt + dxy t( ) = ayt3 + byt2 + cyt + dyz t( ) = azt3 + bzt2 + czt + dz
Cubic Examples
12/1/16
© Bruce Draper & J. Ross Beveridge
11
Notation
12/1/16
© Bruce Draper & J. Ross Beveridge
12
T = t3, t2, t,1!" #$C =
ax ay azbx by bzcx cy czdx dy dz
!
"
######
$
%
&&&&&&
Q t( ) = T ⋅C
Alternatively: Q t( )T =CT ⋅TT
Tangents to Cubic Curves
12/1/16
© Bruce Draper & J. Ross Beveridge
13
ThederivativeofQ(t)isitstangent:
ddt Q(t) = [ x(t), y(t), z(t)]d
dtddt
ddt
ddt Q(t)x = 3axt2 + 2bxt + cx
ddt Q(t) = [3t2, 2t, 1, 0] C
The same matrix as on previous slide
Againthetimemetaphorisuseful,thetangentindicatesinstantaneousdirectionandspeed.
Hermite Curves
12/1/16
© Bruce Draper & J. Ross Beveridge
14
Wewantcurvesthatfittogethersmoothly.Toaccomplishthis,wewouldliketospecifyacurvebyproviding:
• Theendpoints
• The1st derivativesattheendpoints
TheresultiscalledaHermite Curve.
Hermite Curves (cont.)
12/1/16
© Bruce Draper & J. Ross Beveridge
15
Since Q(t) = TC, we factor C intotwo matrices:
G (a 3x4 geometry matrix)M (a 4x4 basis matrix)
such that C = G • M.
Note: G will hold our geometric constraints(endpoints and derivatives), while M willbe constant across all Hermite curves.
Thisstepisabigdeal.Itmakesthinkingaboutcurvegeometrytractable.
Let us concentrate on the x component:P(t) = axt3 + bxt2 + cxt + dx
Remember that its derivative is:
P(t) = 3axt2 + 2bxt + cxddt
Therefore
P(0)xP(1)x
d/dt P(0)xd/dt P(1)x
0 0 0 11 1 1 10 0 1 03 2 1 0
axbxcxdx
=
12/1/16
© Bruce Draper & J. Ross Beveridge
16
Therefore:P(0)xP(1)x
d/dt P(0)xd/dt P(1)x
0 0 0 11 1 1 10 0 1 03 2 1 0
axbxcxdx
=
-1
And taking the inverse:
P(0)xP(1)x
d/dt P(0)xd/dt P(1)x
2 -2 1 1-3 3 -2 -10 0 1 01 0 0 0
axbxcxdx
=
12/1/16
© Bruce Draper & J. Ross Beveridge
17
The Hermite Matrix
12/1/16
© Bruce Draper & J. Ross Beveridge
18
OK,thatwasthexdimension.Howabouttheothers?
Theyare,ofcourse,thesame:
ax ay azbx by bzcx cy czdx dy dz
=
2 −2 1 1−3 3 −2 −10 0 1 01 0 0 0
P 0( )P 1( )dP 0( )dt
dP 1( )dtM
Punchline
12/1/16
© Bruce Draper & J. Ross Beveridge
19
So what does this mean?
Q(t) = T·C =T · MH · [P(0), P(1), d/dt P(0), d/dt P(1)]
Since MH and T are known, you can writedown a cubic polynomial curve by inspectionending at points P(0) and P(1) with tangentsd/dt P(0) and d/dt P(1).
= T ·MH ·[P1, P4, R1, R4]
Punchline
12/1/16
© Bruce Draper & J. Ross Beveridge
20
Since MH and T are known, you can writedown a cubic polynomial curve by inspectionending at points P(0) and P(1) with tangentsd/dt P(0) and d/dt P(1).
Q t( ) = x t( ) y t( ) z t( ) = T ⋅C = T ⋅MH ⋅
P 0( )P 1( )
ddt P 0( )
ddt P 1( )
"
#
$$$$$$$
%
&
'''''''
Expand the Math – Look Inside
12/1/16
© Bruce Draper & J. Ross Beveridge
21
Recall Parametric Equation:
Where
Fully Expanded (note transpose)
Q(t) = T MH G
T
If you Prefer • There are two equivalent setups• The difference is solely transposition
12/1/16
© Bruce Draper & J. Ross Beveridge
22
Examples
12/1/16
© Bruce Draper & J. Ross Beveridge
23
G =
100 100 0200 200 010 10 010 10 0
G = 100 100 0200 200 00 200 0
200 0 0
More Examples
12/1/16
© Bruce Draper & J. Ross Beveridge
24
G =
100 100 0200 200 00 1000 0
1000 0 0G =
100 100 0200 200 0100 2000 0-500 -200 0
Hermite Blending Functions• Conceptual Realignment
– Curves are weighted averages of points/vectors.– Blending functions specify the weighting.
12/1/16
© Bruce Draper & J. Ross Beveridge
25
= Q + + + é
ë
êêê
ù
û
úúú
x1y1z1
( ) - + 2 t3 3 t2 1é
ë
êêê
ù
û
úúú
x2y2z2
( )- + 2 t3 3 t2é
ë
êêê
ù
û
úúú
dx1dy1dz1
( ) - + t3 2 t2 té
ë
êêê
ù
û
úúú
dx2dy2dz2
( ) - t3 t2
= Bh1 - + 2 t3 3 t2 1
= Bh3 - + t3 2 t2 t
= Bh4 - t3 t2
= Bh2 - + 2 t3 3 t2