86
CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier

CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

  • Upload
    others

  • View
    18

  • Download
    7

Embed Size (px)

Citation preview

Page 1: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

CMSC427Parametriccurves:Hermite,Catmull-Rom,Bezier

Page 2: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Modeling

• Creating3Dobjects• Howtoconstructcomplicatedsurfaces?• Goal• Specifyobjectswithfewcontrolpoints• Resultingobjectshouldbevisuallypleasing(smooth)

• Startwithcurves,thengeneralizetosurfaces

2

Page 3: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Usefulness of curves

• Surfaceofrevolution

3

Page 4: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Usefulness of curves

• Extruded/sweptsurfaces

4

Page 5: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Usefulness of curves

• Animation• Providea“track”forobjects• Useascamerapath

5

Page 6: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Usefulness of curves

• Generalizetosurfacepatchesusing“gridsofcurves”,nextclass

6

Page 7: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

How to represent curves

• Specifyeverypointalongcurve?• Hardtogetprecise,smoothresults• Toomuchdata,toohardtoworkwith

• Idea:specifycurvesusingsmallnumbersofcontrolpoints• Mathematics:usepolynomials torepresent curves

Control point

7

Page 8: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Interpolating polynomial curves

http://en.wikipedia.org/wiki/Polynomial_interpolation

• Curvegoesthroughallcontrolpoints• Seemsmostintuitive• Surprisingly,notusuallythebestchoice• Hardtopredictbehavior• Overshoots,wiggles• Hardtoget“nice-looking”curves

Control point

Interpolating curve8

Page 9: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Approximating polynomial curves• Curveis“influenced”bycontrolpoints

• Varioustypes&techniquesbasedonpolynomialfunctions• Bézier curves,B-splines,NURBS

• FocusonBézier curves

Control point

9

Page 10: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Mathematical definition

• Avectorvaluedfunctionofonevariablex(t)• Givent,computea3Dpointx=(x,y,z)• Mayinterpretasthreefunctions x(t), y(t), z(t)• “Movingapointalongthecurve”

x

y

z

x(0.0) x(0.5) x(1.0)

x(t)

10

Page 11: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Tangent vector

• Derivative• Avectorthatpointsinthedirectionofmovement• Lengthofx’(t) correspondstospeed

x’(0.0) x’(0.5) x’(1.0)

x(t)

x

y

z

11

Page 12: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Piecewise polynomial curves• Modelcomplexshapesbysequence• Usepolylinetostorecontrolpoints

12

Page 13: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Continuity• Howpiecewisecurvesjoin• Ck continuity– kthderivativesmatch• Gk continuity– kthderivativesareproportional

13

Page 14: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Cubiccurve(here2D)

𝑥 𝑡 = 𝑎𝑡3 + 𝑏𝑡6 + 𝑐𝑡 + 𝑑𝑦 𝑡 = 𝑒𝑡3 + 𝑓𝑡6 + 𝑔𝑡 + ℎ

• InterpolatesendpointsP0andP1• MatchestangentatendpointsT0andT1• (alsodP0anddP1inthesenotes).

Hermite curves

P0=(x0,y0)

P1 = (x1,y1)T1=<dx1,dy1>

T0=<dx0,dy0>

Page 15: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Derivativeofx(t)

𝑥′ 𝑡 = 3𝑎𝑡6 + 2𝑏𝑡 + 𝑐• Sett=0and1forendpoints• Fourconstraints

𝑥 0 = 𝑑𝑥′(0) = 𝑐

𝑥 1 = 𝑎 + 𝑏 + 𝑐 + 𝑑𝑥′ 1 = 3𝑎 + 2𝑏 + 𝑐

Computing coefficients a, b, c and d

Page 16: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Solvefora,b,candd𝑑 = 𝑥0

𝑐 = 𝑑𝑥0

𝑏 = −3𝑥0 + 3𝑥1 − 2𝑑𝑥0 − 𝑑𝑥1

𝑎 = 2𝑥0 − 2𝑥1 + 𝑑𝑥0 + 𝑑𝑥1

Solve for a, b, c and d

Page 17: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Constraints𝑥 0 = 𝑑𝑥′(0) = 𝑐

𝑥 1 = 𝑎 + 𝑏 + 𝑐 + 𝑑𝑥′ 1 = 3𝑎 + 2𝑏 + 𝑐

• Give

0 0 0 11 1 1 10 0 1 03 2 1 0

𝑎𝑏𝑐𝑑=

𝑥0𝑥1𝑑𝑥0𝑑𝑥1

Matrix version

Page 18: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Sincewehave𝑀𝐴 = 𝐺• Wecansolvewith𝐴 = 𝑀\]𝐺• AndgetHermite basismatrix𝑀\]

𝑎𝑏𝑐𝑑=

2 −2 1 1−3 3 −2 −10 0 1 01 0 0 0

𝑥0𝑥1𝑑𝑥0𝑑𝑥1

Solve matrix version: basis matrix

Page 19: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Toincludex,yandz,rewritewithvectorsP0,P1andtangentsT0andT1

𝒂𝒃𝒄𝒅

=

2 −2 1 1−3 3 −2 −10 0 1 01 0 0 0

𝑷𝟎𝑷𝟏𝑻𝟎𝑻𝟏

• Coefficientsa,b,canddarenowvectors

Vector version

Page 20: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Rewritepolynomialasdotproduct

𝑃 𝑡 = 𝑡3 𝑡6 𝑡 1

𝒂𝒃𝒄𝒅

= 𝑡3 𝑡6 𝑡 1

2 −2 1 1−3 3 −2 −10 0 1 01 0 0 0

𝑷𝟎𝑷𝟏𝑻𝟎𝑻𝟏

Full polynomial version

Page 21: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Insteadofpolynomialint,lookatcurveasweightedsumofP0,P1,T0andT1• 𝑥 𝑡 = 2𝑥0 − 2𝑥1 + 𝑑𝑥0 + 𝑑𝑥1 𝑡3

•+ −3𝑥0 + 3𝑥1 − 2𝑑𝑥0 − 𝑑𝑥1 𝑡6

•+ 𝑑𝑥0 𝑡

•+𝑥0

Blending functions

Page 22: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Insteadofpolynomialint,lookatcurveasweightedsumofP0,P1,T0andT1

• 𝑥 𝑡 =• 2𝑡3 − 3𝑡6 + 1 𝑥0• + −2𝑡3 + 3𝑡6 𝑥1• + 𝑡3 − 2𝑡6 + 𝑡 𝑑𝑥0• + 𝑡3 − 𝑡6 𝑑𝑥1

Blending functions

Page 23: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

ℎ00(𝑡) = 2𝑡3 − 3𝑡6 + 1ℎ01(𝑡) = −2𝑡3 + 3𝑡6

ℎ10(𝑡) = 𝑡3 − 2𝑡6 + 𝑡ℎ11(𝑡) = 𝑡3 − 𝑡6

Blending functions

Page 24: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• HaveP(-1),P0,P1andP2asinput• ComputetangentwithHmatrix

𝑥0𝑥1𝑑𝑥0𝑑𝑥1

=

1 0 0 00 1 0 0−1 1 0 00 0 −1 1

𝑥o𝑥]𝑥\]𝑥6

Computing Hermite tangents

Page 25: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Unifynotation𝑎𝑏𝑐𝑑=

2 −2 1 1−3 3 −2 −10 0 1 01 0 0 0

1 0 0 00 1 0 01 0 −1 00 −1 0 1

𝑥o𝑥]𝑥\]𝑥6

• Finalmatrix

•𝑎𝑏𝑐𝑑=

3 −3 −1 1−5 4 2 −11 0 −1 01 0 0 0

𝑥o𝑥]𝑥\]𝑥6

Combine with Hermite basis

Page 26: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Hermite – problemwithC1continuity

Catmull-Rom curves

P0

P1

P2

P3

P4

P5left right

Page 27: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Catmull-Rom– maketangentsymmetric• Definebytwoadjacentpoints• HereT3=P4-P2

Catmull-Rom curves

P0

P1

P2

P3

P4

P5

Page 28: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• NeedtochangeHmatrix• ½traditionalforC-Rcurves

𝑥0𝑥1𝑑𝑥0′𝑑𝑥1′

=

1 0 0 00 1 0 0

1/2 0 −1/2 0−1/2 0 0 1/2

𝑥o𝑥]𝑥\]𝑥6

Catmull-Rom curves

Page 29: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Whichgives

𝑎𝑏𝑐𝑑=

2 −2 1 1−3 3 −2 −10 0 1 01 0 0 0

1 0 0 00 1 0 0

1/2 0 −1/2 0−1/2 0 0 1/2

𝑥o𝑥]𝑥\]𝑥6

• Or𝑎𝑏𝑐𝑑=

2 −2 −0.5 0.5−3.5 3 1 −0.50.5 0 0.5 01 0 0 0

𝑥o𝑥]𝑥\]𝑥6

Catmull-Rom curves

Page 30: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Bézier curves

http://en.wikipedia.org/wiki/B%C3%A9zier_curve

• Aparticularlyintuitivewaytodefinecontrolpointsforpolynomialcurves• DevelopedforCAD(computeraideddesign)andmanufacturing• Beforegames,beforemovies,CADwasthebigapplicationforCG

• PierreBézier (1962),designofautobodiesforPeugeot,http://en.wikipedia.org/wiki/Pierre_B%C3%A9zier

• PauldeCasteljau (1959),forCitroen

30

Page 31: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Bézier curves

• Higherorderextensionoflinearinterpolation• Controlpointsp0, p1, ...

p0

p1

p0

p1p2

p0

p1

p2

p3

Linear Quadratic Cubic31

Page 32: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Bézier curves

• Intuitivecontrolovercurvegivencontrolpoints• Endpointsareinterpolated,intermediatepointsareapproximated• ConvexHullproperty• Variation-diminishingproperty

32

Page 33: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Cubic Bézier curve

• Cubicpolynomials,mostcommoncase• Definedby4controlpoints• Twointerpolatedendpoints• Twomidpoints controlthetangentattheendpoints

p1

p0 p2

p3

x(t)•

Control polyline

33

Page 34: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Bézier Curve formulation

• Threealternatives,analogoustolinearcase1. Weightedaverageofcontrolpoints2. Cubicpolynomialfunctionoft3. Matrixform• Algorithmicconstruction• deCasteljaualgorithm

34

Page 35: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

de Casteljau Algorithm

http://en.wikipedia.org/wiki/De_Casteljau's_algorithm

• Arecursive seriesoflinearinterpolations• Worksforanyorder,notonlycubic

• Notterriblyefficienttoevaluate• Otherformsmorecommonlyused

• Whystudyit?• Intuitionaboutthegeometry• Usefulforsubdivision(latertoday)

35

Page 36: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

de Casteljau Algorithm

p0

p1

p2

p3

• Giventhecontrolpoints• Avalueoft• Heret≈0.25

36

Page 37: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

de Casteljau Algorithm

p0

q0

p1

p2

p3

q2

q1

q0 (t) = Lerp t,p0 ,p1( )q1(t) = Lerp t,p1,p2( )q2 (t) = Lerp t,p2 ,p3( )

37

Page 38: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

de Casteljau Algorithm

q0

q2

q1

r1

r0

r0 (t) = Lerp t,q0 (t),q1(t)( )r1(t) = Lerp t,q1(t),q2 (t)( )

38

Page 39: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

de Casteljau Algorithm

r1x

r0 •

x(t) = Lerp t,r0 (t),r1(t)( )

39

Page 40: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

x•

p0

p1

p2

p3

de Casteljau algorithm

•Applets• http://www2.mat.dtu.dk/people/J.Gravesen/cagd/decast.html• http://www.caffeineowl.com/graphics/2d/vectorial/bezierintro.html

40

Page 41: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

de Casteljau Algorithm

http://en.wikipedia.org/wiki/De_Casteljau's_algorithm

Linear Quadratic

Cubic Quartic

41

Page 42: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

x = Lerp t,r0 ,r1( )r0 = Lerp t,q0,q1( )r1 = Lerp t,q1,q2( )

q0 = Lerp t,p0 ,p1( )q1 = Lerp t,p1,p2( )q2 = Lerp t,p2 ,p3( )

p0p1p2p3

p1q0

r0 p2x q1

r1 p3q2

p4

Recursive linear interpolation

42

Page 43: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

x = Lerp t,r0 ,r1( )r0 = Lerp t,q0,q1( )r1 = Lerp t,q1,q2( )

q0 = Lerp t,p0 ,p1( )q1 = Lerp t,p1,p2( )q2 = Lerp t,p2 ,p3( )

p0p1p2p3

p1q0

r0 p2x q1

r1 p3q2

p4

Recursive linear interpolation

43

Page 44: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

x = Lerp t,r0 ,r1( )r0 = Lerp t,q0,q1( )r1 = Lerp t,q1,q2( )

q0 = Lerp t,p0 ,p1( )q1 = Lerp t,p1,p2( )q2 = Lerp t,p2 ,p3( )

p0p1p2p3

p1q0

r0 p2x q1

r1 p3q2

p4

Recursive linear interpolation

44

Page 45: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

x = Lerp t,r0 ,r1( )r0 = Lerp t,q0,q1( )r1 = Lerp t,q1,q2( )

q0 = Lerp t,p0 ,p1( )q1 = Lerp t,p1,p2( )q2 = Lerp t,p2 ,p3( )

p0p1p2p3

p1q0

r0 p2x q1

r1 p3q2

p4

Recursive linear interpolation

45

Page 46: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Expand the LERPs

q0 (t) = Lerp t,p0 ,p1( )= 1- t( )p0 + tp1

q1(t) = Lerp t,p1,p2( )= 1- t( )p1 + tp2

q2 (t) = Lerp t,p2 ,p3( )= 1- t( )p2 + tp3

r0 (t) = Lerp t,q0 (t),q1(t)( )= 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )r1(t) = Lerp t,q1(t),q2 (t)( )= 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )

x(t) = Lerp t,r0 (t),r1(t)( )= 1- t( ) 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )( ) +t 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )( )

46

Page 47: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Expand the LERPs

q0 (t) = Lerp t,p0 ,p1( )= 1- t( )p0 + tp1

q1(t) = Lerp t,p1,p2( )= 1- t( )p1 + tp2

q2 (t) = Lerp t,p2 ,p3( )= 1- t( )p2 + tp3

r0 (t) = Lerp t,q0 (t),q1(t)( )= 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )r1(t) = Lerp t,q1(t),q2 (t)( )= 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )

x(t) = Lerp t,r0 (t),r1(t)( )= 1- t( ) 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )( ) +t 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )( )

47

Page 48: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Expand the LERPs

q0 (t) = Lerp t,p0 ,p1( )= 1- t( )p0 + tp1

q1(t) = Lerp t,p1,p2( )= 1- t( )p1 + tp2

q2 (t) = Lerp t,p2 ,p3( )= 1- t( )p2 + tp3

r0 (t) = Lerp t,q0 (t),q1(t)( )= 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )r1(t) = Lerp t,q1(t),q2 (t)( )= 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )

x(t) = Lerp t,r0 (t),r1(t)( )= 1- t( ) 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )( ) +t 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )( )

48

Page 49: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Expand the LERPs

q0 (t) = Lerp t,p0 ,p1( )= 1- t( )p0 + tp1

q1(t) = Lerp t,p1,p2( )= 1- t( )p1 + tp2

q2 (t) = Lerp t,p2 ,p3( )= 1- t( )p2 + tp3

r0 (t) = Lerp t,q0 (t),q1(t)( )= 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )r1(t) = Lerp t,q1(t),q2 (t)( )= 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )

x(t) = Lerp t,r0 (t),r1(t)( )= 1- t( ) 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )( ) +t 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )( )

49

Page 50: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Expand the LERPs

q0 (t) = Lerp t,p0 ,p1( )= 1- t( )p0 + tp1

q1(t) = Lerp t,p1,p2( )= 1- t( )p1 + tp2

q2 (t) = Lerp t,p2 ,p3( )= 1- t( )p2 + tp3

r0 (t) = Lerp t,q0 (t),q1(t)( )= 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )r1(t) = Lerp t,q1(t),q2 (t)( )= 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )

x(t) = Lerp t,r0 (t),r1(t)( )= 1- t( ) 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )( ) +t 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )( )

50

Page 51: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

!

x(t) = 1- t( ) 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )( )+t 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )( )

x(t) = 1- t( )3 p0 + 3 1- t( )2 tp1 + 3 1- t( )t 2p2 + t 3p3

x(t) = -t 3 + 3t 2 - 3t +1( )B0 (t )" #$$$ %$$$

p0 + 3t 3 - 6t 2 + 3t( )B1 (t )" #$$ %$$

p1+ -3t 3 + 3t 2( )

B2 (t )& '$ ($

p2 + t 3( )B3 (t ))p3

Weighted average of control points• Regroup

51

Page 52: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

!

x(t) = 1- t( ) 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )( )+t 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )( )

x(t) = 1- t( )3 p0 + 3 1- t( )2 tp1 + 3 1- t( )t 2p2 + t 3p3

x(t) = -t 3 + 3t 2 - 3t +1( )B0 (t )" #$$$ %$$$

p0 + 3t 3 - 6t 2 + 3t( )B1 (t )" #$$ %$$

p1+ -3t 3 + 3t 2( )

B2 (t )& '$ ($

p2 + t 3( )B3 (t ))p3

Weighted average of control points• Regroup

52

Page 53: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

!

x(t) = 1- t( ) 1- t( ) 1- t( )p0 + tp1( )+ t 1- t( )p1 + tp2( )( )+t 1- t( ) 1- t( )p1 + tp2( )+ t 1- t( )p2 + tp3( )( )

x(t) = 1- t( )3 p0 + 3 1- t( )2 tp1 + 3 1- t( )t 2p2 + t 3p3

x(t) = -t 3 + 3t 2 - 3t +1( )B0 (t )" #$$$ %$$$

p0 + 3t 3 - 6t 2 + 3t( )B1 (t )" #$$ %$$

p1+ -3t 3 + 3t 2( )

B2 (t )& '$ ($

p2 + t 3( )B3 (t ))p3

Weighted average of control points• Regroup

Bernsteinpolynomials53

Page 54: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Partitionofunity,ateacht alwaysaddto1• Endpointinterpolation,B0 andB3 goto 1

x(t) = B0 t( )p0 + B1 t( )p1 + B2 t( )p2 + B3 t( )p3

The cubic Bernstein polynomials :

B0 t( )= -t 3 + 3t 2 - 3t +1

B1 t( )= 3t 3 - 6t 2 + 3t

B2 t( )= -3t 3 + 3t 2

B3 t( )= t 3

Bi (t) = 1å

Cubic Bernstein polynomials

http://en.wikipedia.org/wiki/Bernstein_polynomial

54

Page 55: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

General Bernstein polynomials

B01 t( )= -t +1 B0

2 t( )= t 2 - 2t +1 B03 t( )= -t 3 + 3t 2 - 3t +1

B11 t( )= t B1

2 t( )= -2t 2 + 2t B13 t( )= 3t 3 - 6t 2 + 3t

B22 t( )= t 2 B2

3 t( )= -3t 3 + 3t 2

B33 t( )= t 3

Bin t( )=

ni

æèçöø÷

1- t( )n- i t( )ini

æèçöø÷=

n!i! n - i( )!

Bin t( )å = 1

55

Page 56: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

General Bernstein polynomials

B01 t( )= -t +1 B0

2 t( )= t 2 - 2t +1 B03 t( )= -t 3 + 3t 2 - 3t +1

B11 t( )= t B1

2 t( )= -2t 2 + 2t B13 t( )= 3t 3 - 6t 2 + 3t

B22 t( )= t 2 B2

3 t( )= -3t 3 + 3t 2

B33 t( )= t 3

Bin t( )=

ni

æèçöø÷

1- t( )n- i t( )ini

æèçöø÷=

n!i! n - i( )!

Bin t( )å = 1

56

Page 57: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

General Bernstein polynomials

B01 t( )= -t +1 B0

2 t( )= t 2 - 2t +1 B03 t( )= -t 3 + 3t 2 - 3t +1

B11 t( )= t B1

2 t( )= -2t 2 + 2t B13 t( )= 3t 3 - 6t 2 + 3t

B22 t( )= t 2 B2

3 t( )= -3t 3 + 3t 2

B33 t( )= t 3

Bin t( )=

ni

æèçöø÷

1- t( )n- i t( )ini

æèçöø÷=

n!i! n - i( )!

Bin t( )å = 1

57

Page 58: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

General Bernstein polynomials

B01 t( )= -t +1 B0

2 t( )= t 2 - 2t +1 B03 t( )= -t 3 + 3t 2 - 3t +1

B11 t( )= t B1

2 t( )= -2t 2 + 2t B13 t( )= 3t 3 - 6t 2 + 3t

B22 t( )= t 2 B2

3 t( )= -3t 3 + 3t 2

B33 t( )= t 3

Bin t( )=

ni

æèçöø÷

1- t( )n- i t( )ini

æèçöø÷=

n!i! n - i( )!

Bin t( )å = 1

Partitionofunity,endpointinterpolation

Ordern:

58

Page 59: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

General Bézier curves

• nth-orderBernsteinpolynomialsformnth-orderBéziercurves• Béziercurvesareweightedsumofcontrolpointsusingnth-orderBernsteinpolynomials

Bin t( )=

ni

æèçöø÷1- t( )n- i t( )i

x t( )= Bin t( )pi

i=0

n

å

Bernsteinpolynomialsof ordern:

Béziercurve of ordern:

59

Page 60: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Bézier curve properties

• Convexhullproperty• Variationdiminishingproperty• Affineinvariance

60

Page 61: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Convex hull, convex combination

• Convexhullofasetofpoints• Smallestpolyhedralvolumesuchthat(i)allpointsareinit(ii)lineconnectinganytwopointsinthevolumeliescompletelyinsideit(oronitsboundary)

• Convexcombinationofthepoints• Weightedaverageofthepoints,whereweightsallbetween0 and

1,sumupto1• Anyconvexcombinationalwayslieswithintheconvexhull

p0

p1

p2

Convex hullp3

61

Page 62: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Convex hull property

• Bézier curveisaconvexcombinationofthecontrolpoints• Bernsteinpolynomialsaddto1ateachvalueoft

• Curveisalwaysinsidetheconvexhullofcontrolpoints• Makescurvepredictable• Allowsefficientculling,intersectiontesting,adaptivetessellation

p0

p1

p2

p3

62

Page 63: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Variation diminishing property

• Ifthecurveisinaplane,thismeansnostraightlineintersectsaBézier curvemoretimesthanitintersectsthecurve'scontrolpolyline• “Curveisnotmorewigglythancontrolpolyline”

Yellowline:7intersectionswithcontrolpolyline3intersectionswithcurve 63

Page 64: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Affine invariance

• TwowaystotransformBézier curves1. Transformthecontrolpoints,thencomputeresulting

pointoncurve2. Computepointoncurve,thentransformit

• Eitherway,getthesametransformpoint!• Curveisdefinedviaaffinecombinationofpoints(convexcombinationisspecialcaseofanaffinecombination)• Invariantunderaffinetransformations• Convexhullpropertyalwaysremains

64

Page 65: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Goodforfastevaluation,precomputeconstantcoefficients(a,b,c,d)• Notmuchgeometricintuition

Start with Bernstein form:

x(t) = -t 3 + 3t 2 - 3t +1( )p0 + 3t 3 - 6t 2 + 3t( )p1 + -3t 3 + 3t 2( )p2 + t 3( )p3

Regroup into coefficients of t :x(t) = -p0 + 3p1 - 3p2 + p3( )t 3 + 3p0 - 6p1 + 3p2( )t 2 + -3p0 + 3p1( )t + p0( )1

x(t) = at 3 + bt 2 + ct + d

a = -p0 + 3p1 - 3p2 + p3( )b = 3p0 - 6p1 + 3p2( )c = -3p0 + 3p1( )d = p0( )

Cubic polynomial form

65

Page 66: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Goodforfastevaluation,precomputeconstantcoefficients(a,b,c,d)• Notmuchgeometricintuition

Start with Bernstein form:

x(t) = -t 3 + 3t 2 - 3t +1( )p0 + 3t 3 - 6t 2 + 3t( )p1 + -3t 3 + 3t 2( )p2 + t 3( )p3

Regroup into coefficients of t :x(t) = -p0 + 3p1 - 3p2 + p3( )t 3 + 3p0 - 6p1 + 3p2( )t 2 + -3p0 + 3p1( )t + p0( )1

x(t) = at 3 + bt 2 + ct + d

a = -p0 + 3p1 - 3p2 + p3( )b = 3p0 - 6p1 + 3p2( )c = -3p0 + 3p1( )d = p0( )

Cubic polynomial form

66

Page 67: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Goodforfastevaluation,precomputeconstantcoefficients(a,b,c,d)• Notmuchgeometricintuition

Start with Bernstein form:

x(t) = -t 3 + 3t 2 - 3t +1( )p0 + 3t 3 - 6t 2 + 3t( )p1 + -3t 3 + 3t 2( )p2 + t 3( )p3

Regroup into coefficients of t :x(t) = -p0 + 3p1 - 3p2 + p3( )t 3 + 3p0 - 6p1 + 3p2( )t 2 + -3p0 + 3p1( )t + p0( )1

x(t) = at 3 + bt 2 + ct + d

a = -p0 + 3p1 - 3p2 + p3( )b = 3p0 - 6p1 + 3p2( )c = -3p0 + 3p1( )d = p0( )

Cubic polynomial form

67

Page 68: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Goodforfastevaluation,precomputeconstantcoefficients(a,b,c,d)• Notmuchgeometricintuition

Start with Bernstein form:

x(t) = -t 3 + 3t 2 - 3t +1( )p0 + 3t 3 - 6t 2 + 3t( )p1 + -3t 3 + 3t 2( )p2 + t 3( )p3

Regroup into coefficients of t :x(t) = -p0 + 3p1 - 3p2 + p3( )t 3 + 3p0 - 6p1 + 3p2( )t 2 + -3p0 + 3p1( )t + p0( )1

x(t) = at 3 + bt 2 + ct + d

a = -p0 + 3p1 - 3p2 + p3( )b = 3p0 - 6p1 + 3p2( )c = -3p0 + 3p1( )d = p0( )

Cubic polynomial form

68

Page 69: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• CanconstructothercubiccurvesbyjustusingdifferentbasismatrixB

• Hermite,Catmull-Rom,B-Spline,…

!

x(t) = "a"b "c déë ùû

t 3

t 2

t1

é

ë

êêêê

ù

û

úúúú

"a = -p0 + 3p1 - 3p2 + p3( )"b = 3p0 - 6p1 + 3p2( )"c = -3p0 + 3p1( )d = p0( )

x(t) = p0 p1 p2 p3[ ]

GBez

# $%%% &%%%

-1 3 -3 13 -6 3 0-3 3 0 01 0 0 0

é

ë

êêêê

ù

û

úúúú

BBez

# $%%% &%%%

t 3

t 2

t1

é

ë

êêêê

ù

û

úúúú

T'

Cubic matrix form

69

Page 70: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Cubic matrix form

xx (t) = p0x p1x p2x p3x[ ]

-1 3 -3 13 -6 3 0-3 3 0 01 0 0 0

é

ë

êêêê

ù

û

úúúú

t 3

t 2

t1

é

ë

êêêê

ù

û

úúúú

xy (t) = p0y p1y p2y p3yéë ùû

-1 3 -3 13 -6 3 0-3 3 0 01 0 0 0

é

ë

êêêê

ù

û

úúúú

t 3

t 2

t1

é

ë

êêêê

ù

û

úúúú

xz (t) = p0z p1z p2z p3zéë ùû

-1 3 -3 13 -6 3 0-3 3 0 01 0 0 0

é

ë

êêêê

ù

û

úúúú

t 3

t 2

t1

é

ë

êêêê

ù

û

úúúú

• 3parallelequations,inx,yandz:

70

Page 71: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Bundleintoasinglematrix

• Efficientevaluation• PrecomputeC• Takeadvantageofexisting4x4matrixhardwaresupport

x(t) =p0x p1x p2x p3x

p0y p1y p2y p3y

p0z p1z p2z p3z

é

ë

êêê

ù

û

úúú

-1 3 -3 13 -6 3 0-3 3 0 01 0 0 0

é

ë

êêêê

ù

û

úúúú

t 3

t 2

t1

é

ë

êêêê

ù

û

úúúú

x(t) = GBezBBezTx(t) = C T

Matrix form

71

Page 72: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Drawing Bézier curves

• Generallynolow-levelsupportfordrawingsmoothcurves• I.e.,GPUdrawsonlystraightlinesegments

• Needtobreakcurvesintolinesegmentsorindividualpixels• Approximatingcurvesasseriesoflinesegmentscalledtessellation• Tessellationalgorithms• Uniformsampling• Adaptivesampling• Recursivesubdivision

72

Page 73: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• ApproximatecurvewithN-1 straightsegments• N choseninadvance• Evaluate

• Connectthepointswithlines• Toofewpoints?• Badapproximation• “Curve”isfaceted

• Toomanypoints?• Slowtodrawtoomanylinesegments• Segmentsmaydrawontopofeachother

x0

x2x3

Uniform sampling

!

xi = x ti( ) where ti =iN

for i = 0, 1,", N

xi =#a i

3

N 3 +#b i2

N 2 +#c iN+ d

x4

x1

x(t)

73

Page 74: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Useonlyasmanylinesegmentsasyouneed• Fewersegmentswherecurveismostlyflat• Moresegmentswherecurvebends• Segmentsneversmallerthanapixel

• Variousschemesforsampling,checkingresults,decidingwhethertosamplemore

Adaptive Sampling

x(t)

74

Page 75: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Recursive Subdivision• Anycubic(ork-thorder)curvesegmentcanbeexpressedasacubic(ork-thorder)Béziercurve

“Anypieceofacubic(ork-thorder)curveisitselfacubic(ork-thorder)curve”

• Therefore,anyBéziercurvecanbesubdividedintosmallerBéziercurves

75

Page 76: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• deCasteljau constructionpointsarethecontrolpointsoftwoBéziersub-segments(p0,q0,r0,x) and(x,r1,q2,p3)

xp0

p1

p2

p3

de Casteljau subdivision

q0r0

r1

q2

76

Page 77: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Adaptive subdivision algorithm

1. UsedeCasteljauconstructiontosplitBéziersegmentinmiddle(t=0.5)

2. Foreachhalf• If“flatenough”:drawlinesegment• Else:recursefrom1.foreachhalf

• Curveisflatenoughifhullisflatenough• Testhowfarawaymidpointsarefromstraightsegmentconnectingstartandend• Ifaboutapixel,thenhullisflatenough

77

Page 78: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Today

Curves• Introduction• Polynomialcurves• Béziercurves• DrawingBéziercurves• Piecewisecurves

78

Page 79: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

More control points

• CubicBéziercurvelimitedto4controlpoints• Cubiccurvecanonlyhaveoneinflection• Needmorecontrolpointsformorecomplexcurves

• k-1 orderBéziercurvewithk controlpoints

• Hardtocontrolandhardtoworkwith• Intermediatepointsdon’thaveobviouseffectonshape• Changinganycontrolpointchangesthewholecurve

• Wantlocalsupport• Eachcontrolpointonlyinfluencesnearbyportionofcurve

79

Page 80: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Sequenceofsimple(low-order)curves,end-to-end• Piecewisepolynomialcurve,orsplines

http://en.wikipedia.org/wiki/Spline_(mathematics)

• Sequenceoflinesegments• Piecewiselinear curve(linearorfirst-orderspline)

• Sequenceofcubiccurvesegments• Piecewisecubic curve,herepiecewiseBézier(cubicspline)

Piecewise curves (splines)

80

Page 81: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Piecewise cubic Bézier curve

!

• Given 3N +1 points p0 ,p1,",p3N

• Define N Bézier segments:x0 (t) = B0 (t)p0 + B1(t)p1 + B2 (t)p2 + B3(t)p3

x1(t) = B0 (t)p3 + B1(t)p4 + B2 (t)p5 + B3(t)p6

#

xN -1(t) = B0 (t)p3N -3 + B1(t)p3N -2 + B2 (t)p3N -1 + B3(t)p3N

x0(t) x1(t)

x2(t)x3(t)

p0

p1p2

p3

p4p5

p6

p7 p8

p9

p10 p11

p12

81

Page 82: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• Globalparameteru,0<=u<=3N

Piecewise cubic Bézier curve

!

x(u) =

x0 ( 13 u), 0 £ u £ 3

x1( 13 u -1), 3 £ u £ 6

" "

xN -1( 13 u - (N -1)), 3N - 3 £ u £ 3N

ì

íïï

îïï

x(u) = xi 13 u - i( ), where i = 1

3 uêë úû

x0(t) x1(t)

x2(t)x3(t)

x(3.5)

x(8.75)

u=0u=12

82

Page 83: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Continuity

• Wantsmoothcurves• C0 continuity

• Nogaps• Segmentsmatchattheendpoints

• C1 continuity:firstderivativeiswelldefined• Nocorners• Tangents/normalsareC0 continuous(nojumps)

• C2 continuity:secondderivativeiswelldefined• Tangents/normalsareC1 continuous• Importantforhighqualityreflectionsonsurfaces

83

Page 84: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

• C0 continuousbyconstruction• C1 continuousatsegmentendpointsp3i if p3i - p3i-1 = p3i+1 - p3i• C2 ishardertoget

Piecewise cubic Bézier curve

p0

p0

p1

p2

P3

P3

p2

p1

p4

p5

p6

p6

p5

p4

C1 continuousC0 continuous84

Page 85: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Piecewise cubic Bézier curves

• Usedoftenin2Ddrawingprograms• Inconveniences• Musthave4or7or10or13or…(1plusamultipleof3)controlpoints• Somepointsinterpolate(endpoints),othersapproximate(handles)• Needtoimposeconstraintsoncontrolpointstoobtain

C1 continuity• C2 continuitymoredifficult

• Solutions• Userinterfaceusing“Bézierhandles”• GeneralizationtoB-splines,nexttime

85

Page 86: CMSC427 Parametric curves: Hermite, Catmull-Rom, Bezier · 2017-12-05 · Parametric curves: Hermite, Catmull-Rom, Bezier. Modeling •Creating 3D objects •How to construct complicated

Bézier handles

• Segmentendpoints(interpolating)presentedascurvecontrolpoints• Midpoints(approximatingpoints)presentedas“handles”• CanhaveoptiontoenforceC1 continuity

[www.blender.org] Adobe Illustrator 86