25
Hermite Curves Introduction to 3 rd -order curves Nov. 29 th , 2016

cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

Hermite Curves

Introduction to 3rd-order curvesNov. 29th, 2016

Page 2: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 3: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 4: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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.

Page 5: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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.

Page 6: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 7: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 8: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 9: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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( )

Page 10: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 11: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

Cubic Examples

12/1/16

© Bruce Draper & J. Ross Beveridge

11

Page 12: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 13: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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.

Page 14: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

Hermite Curves

12/1/16

© Bruce Draper & J. Ross Beveridge

14

Wewantcurvesthatfittogethersmoothly.Toaccomplishthis,wewouldliketospecifyacurvebyproviding:

• Theendpoints

• The1st derivativesattheendpoints

TheresultiscalledaHermite Curve.

Page 15: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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.

Page 16: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 17: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 18: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 19: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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]

Page 20: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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( )

"

#

$$$$$$$

%

&

'''''''

Page 21: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 22: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

If you Prefer • There are two equivalent setups• The difference is solely transposition

12/1/16

© Bruce Draper & J. Ross Beveridge

22

Page 23: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 24: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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

Page 25: cs410 F16 Lecture18 - Colorado State Universitycs410/yr2016fa/more...Announcements • PA4 due today (at 3:00 J ) • PA5 due in 1 week – Ross has posted it to the web site – Adds

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