Upload
others
View
12
Download
1
Embed Size (px)
Citation preview
EECS487:Interactive
ComputerGraphicsLecture36:Parametricsurfaces
• Sweptsurfaces
• Geometriccontinuity
• Béziercurvesandpatches
Extruded/SweptSurfaces
Yu,Terzopoulos
Consideracurveinspaceasbeingsweptout
byamovingpoint:p(u) = [x(u) y(u) z(u)]T
• aswevaryuthepointmovesthroughspace
• thecurveisthepathtakenbythepoint
Similarlywecanthinkofasurface:
s(u, t) = [x(u, t) y(u, t) z(u, t)]T
• asbeingsweptoutbyaprofilecurve
alongatrajectorycurve
• thesetofpointsvisitedbythecurveduringitsmotiondefinesthesurface
GeneralSweepSurfaces
Fussell,Durand,Terzopoulos
Trajectorypathmaybeanyarbitrarycurve
Theprofilecurvemaybetransformed
asitmovesalongthepath
• scaled,rotatedwithrespecttopathorientation,…
Example:surfaces(u, t) isformedbyaprofile
curveinthexy-planep(u) = [x(u) y(u) 0 1] T
extrudedalongthez-axis:s(u, t): T(t)p(u):x(u, t) = x(u), y(u, t) = y(u), 0 ≤ u ≤ 1, z(u, t) = t, zmin ≤ t ≤ zmax
Extruded/SweptSurfaces
Differentprofilecurves,
sametrajectorycurve
Schulze
SurfacesofRevolution
Schulze,Durand
Userotationaroundan
axisinsteadoftranslation
alongapath
• or,extrusionwherethe
trajectorycurveisacircle • s(u, t): R(t)p(u)
ABananaasaGeneralizedCylinder
Whatwespecify
• amostlycircularprofile
• aspineforthebanana• ascalingfunction
Periodicallyalongthespine
• placeacrosssection• scaleitappropriately• connecttoprevioussection
crosssection scalingfunction
Yu,Snyder
GeneralSweepSurfaces
Thetrajectorycurveislikeaspine
• sweepingtheprofilecurve“skins”asurfacearoundthe
trajectorycurve
• theshapeofthespinecontrolstheshapeoftheobject
• niceforanimation:• don’thavetocontrolthesurface• justreshapethespineandthesurfacefollowsalong
Yu,Chenney,Terzopoulos
GeneralSweepSurfaces
Foreverypointalongq(t),layp(u)sothatopcoincideswithq(t)
Thisgivesuslocationsalongq(t),howaboutorientation?
1. fixedorstatic:alignsp(u)withanaxis
2. allowssmoothlyvaryingorientationthat“follows”the
orientationofq(t):howtospecifytheorientationofq(t)?
p(u) q(t)
op
Curless
p(u)
q(t)
op
s(u, t)
DifferentialGeometryofCurves
Uses:
• defineorientationofsweptsurfaces
• computevelocityofanimation
• computenormalsofsurfaces
• analyzesmoothness/continuity
Tangent:
Thevelocityofmovement,1stderivativewithrespecttotq’(t) = (x’(t), y’(t), z’(t))orq’(t) ≈ (q(t+Δt) – q(t))/Δt• ||q’(t)||isthespeedofmovement
• normalizedtangentt(t) = q’(t)/||q’(t)||isthedirectionofmovement
• thenumericformofforwarddifferenceisusefulifq(t)isablackbox
Thetangentprovidesuswiththefirstofthree
orientationsforsweptsurfaces
Durand
Forsmoothmotion,wewantcontinuous1stand2nd
derivativeswithrespecttotimedq/dt
Buttodescribeshape,wecouldaskforcontinuity
withrespecttoequalsteps(arclength):dq/ds
Arclengthparameterization:
equalstepsinparameter
spacesmapstoequal
distancesalongthecurve
• intrinsictoshapeofcurve,notdependentonanyparticularcoordinatesystem
ArcLengthParameterization
TP3,Hart [Curless]
q(t) q(s)
Ifsisthelengthofcurvefromq(0)toq(t),q(s) canbeexpressedintermsoft:q(s) = {q(t): s(t) = s},e.g.,
Unlessmovingatconstant
speed,arclength
travelledisnot
proportionaltopassingtime:
• i.e.,equalstepsintime(t)doesnotnecessarilygiveequaldistancesinarclength(s)
ArcLengthParameterization
TP3,Hart,Curless
q(t) q(s)
t = 0, s = s(0) = 0
t = 1, s = s(1) = curvelength
s(t) = q '(τ ) dτ
0
t
∫ = x '(τ )2 + y '(τ )2 + z '(τ )2 dτ0
t
∫usually
cannotbe
evaluated
analytically
Instead:
• pre-computeasetofvariablearclengthssiforpointsonthe
curveusingtparameterization
• tofindthecorrespondingpoint(pk)
onthecurveforagivensk,linearly
interpolatethepointsofthe2nearestarclengthstoeitherside
siandsi+1,si ≤ sk ≤ si+1:
ArcLengthbyLinearInterpolation
pk =
si+1 − sk
si+1 − si
pi +sk − si
si+1 − si
pi+1
TP3
CurvatureandNormal
lowcurvature
highcurvatureDurand
Curvature(κ):derivativeoftangentwithrespecttoarclength(dt(s)/ds)• howfastthecurvepullsaway
fromastraightline
• alwaysorthogonaltotangent
• constantforacircle• zeroforastraightline
Normal:normalizedcurvature
• vectorpointstothecenterofcurvature
• the2ndof3orientationsforsweptsurfaces
TorsionandBinormal
Béchet
Torsion:deviationofthecurve
fromtheplaneformedbythe
tangentandnormalvectors
• zeroforaplanecurve• binormalvectorpointstothewinding
directionofthespacecurve
• the3rdof3orientationsforsweptsurfaces
Acurveisa1Dmanifoldinaspaceofhigherdimension
• Plane(2D)curves,describedby:
• position,tangent,curvature
• Space/skew(3D)curves,describedby:• position,tangent,curvature,torsion
FrenetFrame
Givenacurve q(t)wecanattachasmoothlyvarying
coordinatesystemconsistingofthreebasisvectors
(reparameterizedtoarclength):
• tangent:t(s) = q’(s(t))(normalized)
• normal:n(s) = t’(s)/||t’(s)||• binormal:b(s) = n×t
DuetoJeanFrédéricFrenet(1847)andJosephAlfredSerret(1851)
Aswemovealongq(t),theFrenetframe(t(s),b(s),n(s))variessmoothly
Curless
q(t)
q’(s)
q’’(s)
normalplane
formedbynandb
osculatingplane
formedbynandt
FrenetSweptSurfaces
Curless,wikipedia
Orienttheprofilecurve p(u)usingtheFrenetframeofthetrajectoryq(t)• putp(u)inthenormalplaneofq(t)• placeoponq(t)• alignpx(u)withb• alignpy(u)with−n
Ifq(t)isacircle,yougetasurfaceofrevolutionexactly!
q(t)
py(u)
px(u)
op
p(u)
Variations
Curless,Funkhouser
q(t)
p(u)
q
b t
n
Severalvariationsarepossible:
• scalep(u)asitmoves,
possiblyscaledto||q(t)||• morphp(u)intosomeothercurve
f(u)asitmovesalongq(t)
ProblemswithSweptSurfaces
Whathappensatinflectionpoints?
• curvaturegoestozero• thennormalflips!
• resultinginanon-smoothsweptsurface
Also,difficulttoavoidself-intersection
Curless,Fussell,Durand,Chenney
Free-formSurfaces
Sweptsurfacesaregreat,butwewould
liketorepresent“free-form”(asymmetric,
irregular)curvesandsurfaces
Wewouldalsoliketogivemodelbuilders
anintuitivecontrolofasmoothshape
• specifyobjectswithafewcontrolpoints
• resultinginvisuallypleasing(smooth)objects
Schulze
CAGD(Computer-AidedGeometricDesign):
areaofCGdealingwithfree-formshapes
1960’s:• theneedformathematicalrepresentationsoffree-form
shapesbecameapparentintheautomotiveand
aeronauticindustries
• PauldeCasteljau&PierreBézierindependentlydevelopedthetheoryofpolynomialcurves&surfaces
• whichbecamethebasictoolfordescribingandrendering
free-formshapes
PolynomialSurfaces
TP3
ParametricPatches
Parametriccurvesandsurfacesgiveandrequire
fewerdegreesofcontrolthanpolygonalmeshes
• userscontrolafewpoints
• programsmoothlyfillsintherest
• representationprovidesanalyticalexpressionsfornormals,tangents,etc.
Surfaceispartitionedintopatches:
• piecewiseparametricsurfaces(3Dsplines)
• eachdefinedbycontrolpointsforming
acontrolnet
Mostpopularformodelingare
Bézier,B-splines,andNURBS
• we’llstudytheseas2Dsplinesfirst,
thenwe’llusethemas3DpatchesFunkhouser,FvDFHFig.11.44
MeasuresofJoint
Smoothness
Parametriccontinuity:
• continuousbyparametert• usefulfortrajectories• 0thorder,C0�curvesegmentsmeet(joinpoint):f2(0) = f1(1)
• 1storder,C1�
1stderivatives,velocities,areequalatjoinpoint:f2’(0) = f1’(1)
• 2ndorder,C2�
2ndderivatives,accelerations,areequalatjoinpoint
y (t )
x(t )
SC1C0
C2
Join point
Foley,vanDam92
�
C1
�
C0
�
C2y(t)
x(t)
Hodgins,Marschner
C0 C1 C2
JointSmoothness
C0continuous
• curve/surfacehasnobreaks/gaps/holes• modelis“watertight”
C1continuous
• model“lookssmooth,no
facets”(butsometimes
lookslikealumpypotato)
C2continuous
• looksmorepolished:
smoothspecularhighlights
DurandC2almosteverywhere C1only
C 0
C1
C2
G1
G2
MeasuresofJointSmoothness
Geometriccontinuity:
• continuousbyparameters (arclength)• usefulfordefiningshapes
• 1storder,G1
1stderivatives,tangents,areinthesame
directionandofproportionalmagnitude
atjoinpoint:f2’(0) = k f1’(1), k > 0
• 2ndorder,G2
2ndderivatives,curvatures,
areproportionalatjoinpoint
� GncontinuityisusuallyaweakerconstraintthanCncontinuity
(e.g.,the“speed”alongthecurvedoesnotmatter)
ButneitherformofcontinuityisguaranteedbytheotherShirley,Marschner
G1butnotC1whentangentdirectiondoesn’tchange,
butthemagnitudechangesabruptly
y (t )
x (t )
P1P2
Q3P3
Q2Q1
TV2
TV3
�
C1�
G1
y(t)
x(t)
Rockwoodetal.,Marschner,FvD
G1notC1 C1notG1
Rockwoodetal.,Marschner
Whenthecurvep(t)goestozero,velocitychanges
direction,andstartsagain
p(t)
CubicSplines
Arepresentationofcubicsplineconsistsof:
• fourcontrolpoints(whyfour?)
• thesearecompletelyuserspecified
• determineasetofblendingfunctions
Thereisnosingle“best”representationofcubicspline:
*n/awhensomeofthecontrol“points”aretangents,notpoints
Cubic Interpolate? Local? Continuity Affine? Convex*? VD*?
Hermite � � C1 � n/a n/a
Cardinal
(Catmull-Rom)
except
endpoints
� C1 � no no
Bézier endpoints � C1 � � �
natural � � C2 � n/a n/a
B-splines � � C2 � � �
Watt
BézierCurve
NamedafterPierreBézier,
acardesigneratRenault
Independentlydevelopedby
PauldeCasteljauatCitroën
Hasanintuitivegeometric“feel”,
easytocontrol• commoninterfaceforcreatingcurvesin
drawingprograms
• usedinfontdesign(Postscript)
Foley&vanDam
BézierCurve
Usesanarbitrarynumberof
controlpoints(notjustcubic)
• thefirstandlastcontrolpointsinterpolatethecurve
• therestapproximatethecurve,controlpointiexertsthestrongestattractionatu = i/n, 1 ≤ i < n−1, 0 ≤ u ≤ 1
• tangentatthestartofthecurveisproportionaltothevectorbetweenthefirstandsecondcontrolpoints
• tangentattheendofthecurveisproportionaltothevectorbetweenthesecondlastandlastcontrolpoints
• then-thderivativeatthestart(end)ofthecurvedependsonthefirst(last)n+1controlpoints
p0
p1
p2
p3
p1-p
0
p3-p2
f’(0)=3(p1-p0)
f’(1)=3(p3-p2)
cubic
Shirley
deCasteljauAlgorithm
AgeometricevaluationschemeforBézier:
createsBéziercurveiteratively
Tocomputef(u):• connectadjacentcontrolpointswith
straightlinesintoacontrolpolygon
• createtheuinterpolatepoints,u ∈ [0,1],ontheselines• ateachiteration,therearen-1suchpoints
• connectthenewpointswithstraightlines
• repeatuntilonlyonenewpointiscreated
u
u
u
1–u 1–u
1-u
1–u
u1–u
1–u
uu
deCasteljauQuadraticBézier
4/5
1/5 4/5
1/5 1/5
4/5
quadratic
Letu = 45
pk = p0 + 45 (p1 − p0 ) = 1
5 p0 − 45 p1
q0 = 15 ( 15 p0 + 4
5 p1)+ 45 ( 15 p1 + 4
5 p2 )Ormoregenerally:
f (u) = (1− u)((1− u)p0 + up1)+ u((1− u)p1 + up2 )whichisthequadraticBéziercurve:
f (u) = (1− u)2p0 + 2u(1− u)p1 + u2p2
AquadraticBéziercurvehas3controlpoints
deCasteljauCubicBézierGivenfourcontrolpointsp0, p1, p2, p3,use
deCasteljaualgorithmtobuildacubicBéziercurve
f(u), 0 ≤ u ≤ 1,withp0 = f(0), p3 = f(1)asshown:
1
2 3
4 1
2 3
4
�
p0
�
p1
�
p2
�
p3
q0 = p0 + u p1 − p0( )= (1− u)p0 + up1
q1 = (1− u)p1 + up2q2 = (1− u)p2 + up3 u = ½
u = ¼u = ¾
1–u
u
u
1–u
u 1–u
q0
q1
q2
u
1–u u
1–ur0 r1u 1–u
f(u)
r0 = (1− u)q0 + uq1r1 = (1− u)q1 + uq2
f(u) = (1− u)r0 + ur1f(u) = (1− u)3p0 + 3u(1− u)
2p1 + 3u2 (1− u)p2 + u
3p3
Drawoutthecurvebysweepingthroughtime
deCasteljauCubicBézier
[wikipedia]
f(u) = (1− u)3p0 + 3u(1− u)2p1 + 3u
2 (1− u)p2 + u3p3
Thenset:
f '(0) = 3(p1 − p0 )f '(1) = 3(p3 − p2 )
CubicBézierCurve
Controlpointsconsistofendpointinterpolationsand
derivatives:
Constraintmatrix
Basismatrix:
C =
1 0 0 01 1
3 0 01 2
313 0
1 1 1 1
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
B = C−1 =
1 0 0 0−3 3 0 03 −6 3 0−1 3 −3 1
⎡
⎣
⎢⎢⎢⎢
⎤
⎦
⎥⎥⎥⎥
f(u) = a0 + u1a1 + u2a2 + u3a3
p0 = f(0) = a0 + 01a1 + 02a2 + 03a3
p3 = f(1) = a0 + 11a1 + 12a2 + 13a33(p1 − p0 ) = f '(0) = a1 + 2*0
1a2 + 3*02a3
p1 = 13 (f '(0)+ 3p0 ) = a0 + 1
3 a1 + 02a2 + 0
3a33(p3 − p2 ) = f '(1) = a1 + 2* 1
1a2 + 3*12a3
p2 = 13 (3p3 − f '(1)) =1a0 + 2
3 a1 + 13 a2 − 0a3
Blendingfunctions:
CubicBézierCurve
Watt,Hodgins
f (u) = (1− u)3p0 + 3u(1− u)2p1 + 3u2 (1− u)p2 + u3p3
= (1− 3u + 3u2 − u3 )p0 + (3u − 6u2 + 3u3 )p1 + (3u
2 − 3u3 )p2 + u3p3
x
y
b(u)
u
uB = bi (u)i=0
n
∑
b0,3(u)
b0,3(u)
b1,3(u)
b1,3(u)
b2,3(u)
b2,3(u)
b3,3(u)
b3,3(u)
CubicBézierProperties
Properties:
• eachbispecifiestheinfluenceof pi
• convexhull:∑bi = 1, bi ≥ 0• interpolatesonlyatp0andp3• b0 =1atu = 0,b3 =1atu = 1• b1andb2 neverreach1
• thebasisfunctionsareeverywhere
non-zero,exceptattheendpoints
�thecontrolpointsdonotexert
localcontrol
• thecurvesaresymmetric:reversing
thecontrolpointsyieldsthesame
curve
b0
b1 b2
b3
u
b(u)
u = 1 u = 0
p0
p2
p3
p1
Durand,Hodgins
Watt
Non-LocalControl
Everycontrolpointaffectseverypoint
onthecurve(excepttheendpoints)
Movingasinglecontrolpointaffects
thewholecurve!
Curless
VariationDiminishingProperty
Béziercurveshavethevariationdiminishingproperty:
eachisnomore“wiggly”thanitscontrolpolygon
�doesnotcrossalinemorethanitscontrolpolygon
VariousBéziercurves,ofdegrees2-6:
Shirley
BernsteinBasisPolynomials
Theblending/basisfunctionsforBéziercurvescan
ingeneralbeexpressedastheBernsteinbasis
polynomials:
Béziercurveeqn:
bk,n (u) =nk
⎛⎝⎜
⎞⎠⎟uk (1− u)n−k = n!
k!(n − k)!uk (1− u)n−k
f(u) = n!k!(n − k)!
uk (1− u)n−kpkk=0
n
∑
Shirley
Multiple-segmentcubicBéziercurvecanachieve
• G1continuityif:q0 = f2(0) = f1(1) = p3
and(q1 − q0) = k(p3 − p2),thethreepoints(p2,p3 = q0,andq1)arecollinear
• ifyouchangedoneofthesethree,youmustchangetheothers,butonly
needtochangethesethree,
notp1forexample�localsupport
• C1continuityifk = 1
• can’tguaranteeC2orhighercontinuity• eachadditionaldegreeofcontinuityrestrictsthepositionofanadditionalcontrolpoint�cubicBézierhasnonetospare
�
p3 = q0�
p2
�
q1�
f1(u)
�
f 2(u)
JoiningBézierCurves
Shirley
BézierCurve/SurfaceProblems
TomakealongcontinuouscurvewithBézier
segmentsrequiresusingmanysegments
Maintainingcontinuityrequiresconstraintsonthe
controlpointpositions
• theusercannotarbitrarilymovecontrolpointsand
automaticallymaintaincontinuity
• theconstraintsmustbeexplicitlymaintained
• itisnotintuitivetohavecontrolpointsthatarenotfree
Consider:B-spline