Presentation on theme: "G Topics in Computer Graphics Lecture Geometric Model"— Presentation transcript
G22.3033-002:TopicsinComputerGraphics:Lecture#2GeometricModelingNewYorkUniversity
BezierCurvesandB-splines,BlossomingLecture#2:16September2002Lecturer:Prof.DenisZorinScribe:KranthiKGadeInthislecture,wediscusspolynomialparametriccurves,whichisthemostcommonlyused
G22.3033-002:Lecture#2curvatureislikelytobediscontinuousunlessitiszero.Cubicsontheotherhandmayhavepointsofinßectionwithcurvaturechangingcontinuously.Torepresentarbitrarilycomplexcurvesoneusuallyusespiecewisepolynomials,stitchingtogethermanypolynomialpieces.Thenextquestionweneedtoaddressishowtospecifypolynomialcurves.ThemoststraightforwardapproachistodeÞneacurveusingthepolynomialcoefÞcients.Forexample,atwo-dimensionalcurvecanberepresentedusingpolynomialsinthefollowingway:Õsaretwo-dimensionalpoints.Onecanseethatistheweightedaverageofbutitisnotintuitivelyclearthoughhowistraversedaschanges,andhowinßuencetheshapeofBezierCurvesOnecanmakethecoefÞcientsdescribingapolynomialmoreintuitivebychangingthebasisfunctions.Insteadofusingthestandardmonomialbasisbasis,t,t,weusethethe(Št)3,3t(1Št)2,3t2(1Št),t3].Onewaytoderivethissetofbasisfunctionistolookattheexpansionof1=(1=(1Whythisbasis?WeshallseethatBeziercurveshaveanumberofniceproperties.BernsteinbasisisdeÞnedforany.For,thebasisisis(Št),t]andforitisis(Št)2,2t(1Št),t2].TheBernsteinbasisforareshowninFigure1.AnypolynomialcanbewrittenasacombinationofthefourpolynomialsoftheBernsteinbasis.Ifarefourpointsinspace,thenthecubicpolynomialcurveisthepolynomialiscalledacubicBeziercurvewithcontrolpointsPropertiesofcubicBeziercurvesInterpolation.Onecaneasilyseethat(0)=(1)=,i.e.theBeziercurveinterpolatesthepointsAfÞneInvariance.ThispropertycanbeeasilyveriÞedbyconsideringanafÞnemapisamatrixandisin.Now=(ThelasttransformationusesthefactthatBernsteinbasisfunctionssumuptoone(1).
G22.3033-002:Lecture#2
113,0B3,1B3,2B3,3
Figure1:Bernsteinbasisfunctionsfor
Figure2:BezierInterpolation3.TangenttothecurveatpointisthevectorandtangenttothecurveatThiscanbeeasilyveriÞedbydifferentiating(2)andsubstitutingappropriateparametervalues:.ThispropertycanbeusedtotestwhethertwoBeziercurvesarejoinedsmoothly:usethispropertytoÞndthetangentsatthecommonpointandthenseewhethertheyareparallel.ConvexHull.Itisclearthatthat,1].Thisand(1)meansthatallpointsontheBeziercurvelieinsidetheconvexhullofpointsPolarformsandblossomingPolarformofapolynomialofofdegreeisamultiafÞnesymmetricfunctionsuchthatt,t,...,t
Wefocusonthecase.ThetwopropertiesofpolarformsaredeÞnedasfollows:
G22.3033-002:Lecture#2
Figure3:BlossomingforBeziercurves.AfunctionifthevalueofthefunctionisthesameforanypermutationoftheargumentsAfunctionifforanyargumentsandany,...,at+(1)+(1Foranypolynomial,thereexistsauniquesymmetricandmultiafÞnepolarform.Wedonotgiveaformalproofforitbutanintuitionbehinditforthecasewillmakeitclear.BecausethepolarformismultiafÞneitislinearineachargument;thereforeitisapolynomial,oftotalpowerasitfollowsfrom(3).Thereforethepolarformcanbeexpressed.Writingequationsforsymmetryandtaking(3)intoaccountyieldsa
3(t1+t2+t32
isthepolarformofacubicpolynomial,thenthevalueofforanyarbitrarycanbefoundifthevaluesofgiven.ThisisdonebyrepeatedlinearinterpolationandisshowninFigure3.Inthiswaywecancomputethevalueofthepolynomialatanypointusingasequenceoflinearinterpolations.PolarformrepresentationisusefulbecauseitprovidesauniformandsimpleapproachtocomputingvaluesofapolynomialusingavarietyofrepresentationsfromBeziercurvestoNURBS(non-uniformrationalB-splines).B-splinesisadifferentapproachtorepresentingpiecewisepolynomialcurves,whichovercomessomeofthedrawbacksofBeziercurves.Supposewewishtodesignalongcurvewithmanyundulations.Oneapproachwouldbetouseahigh-degreeBeziercurve.Aswehavealreadydiscussed,thisisnotaverygoodapproach;alsonotethateachofcontrolpointsofaBeziercurveofdegreeinßuencesthewholecurve,whichmeansthatitisdifÞculttointroduceasmallfeaturewithoutchangingthecurveeverywhere.AnotherapproachusingBeziercurvesistoconstructthecurvefrommanyparts
G22.3033-002:Lecture#2piecewiseBezier);inthiscaseweneedtomatchatleastthevaluesandtangentsattheendpointsofeachsegment.ValuesareeasilymatchedbyconstrainingthelastcontrolpointofsegmentandtheÞrstcontrolpointofsegmenttobethesame:.Tangentscanbemadethesameifthepointsofthesegmentsareconstrainedtobeonthesameline.Thisisthewaycurvesareconstructedinmanydrawingprograms,forexample,inAdobeIllustrator.Resultingcurvesneednotbehowever,anditisnotthateasytomakethemÒfairÓwhichtypicallymeansthatwewantthecurvaturenottochangeabruptly.Tosummarize,threecommonlydesirablepropertiesofcurvesare:Shouldbecontinuousatallpoints.Interpolation:Shouldinterpolatetheinputcontrolpoints.Localcontrol:ThemodiÞcationofaparticularcontrolpointshouldmodifythecurveonlylocally.Aswehaveseen,piecewiseBeziercurvesinterpolatethecontrolpointssharedbysegments,andhavelocalcontrol,butneednotbe-continuous.Itturnsoutthatthesethreepropertiesareincompatibleforcubiccurves:e.g.ifweattempttowriteasystemofequationsthatensuresthatsequentialBeziersegmentsarejoinedwithcontinuity,wewillseethatÒinteriorÓcontrolforsegmenthavetodependontheendpointsforall,i.e.thereisnolocalcontrol.IfwegiveuptheinterpolationpropertythereisatypeofpiecewisecubicpolynomialcurveswhichsatisÞestheremainingrequirementscalledtheB-splinecurves.Ifwerequireinterpola-tionbutgiveuplocalcontrolwegetcurvescallednaturalsplines,whichwewillnotdiscussinAB-splinecurvedeÞnedeverywhereoncanbewritteninthefollowingform:arecontrolpointsandarethebasisfunctionsassociatedwithcontrolpointsEachbasisfunctioncanbethoughtofasthevariableweightwhichdetermineshowthecontrolinßuencesthecurveatparametricvalue.Foruniformsplines,thebasisfunctionsforaÞxedfunctionWechoosethebasisfunctioninsuchawaythattheresultingcurvesaretheinßuenceofthecontrolpointsislocal(i.e.onthesmallestpossibleinterval)andthecurvesarepiecewisecubicpolynomialsoneacheachintervalali,i+1].Wewouldliketheinßuenceofacontrolpointtobemaximalatregionsofthecurveclosetoitandforthisinßuencetodecreaseaswemoveawayalongthecurveanddisappearcompletelyatsomedistance.AlsodesirableisafÞneinvariancepropertythatwehaveseenforBeziercurves.wedescribehowtoconstructbasisfunctionssatisfyingalltheserequirements.TherearemanydifferentwaystodeÞneB-splines;wewillconsidertwoequivalentdeÞni-tions:usingconvolutionandusingblossoming.
G22.3033-002:Lecture#2B-splinebasisfunctionsWestartwiththesimplestfunctionswhichalreadymeetsomeoftherequirementsabove:piece-wiseconstantcoordinatefunctions.AnypiecewiseconstantfunctioncanbewrittenasBoxBoxistheboxfunctiondeÞnedasBoxWedeÞnetheconvolutionoftwofunctionsfgTheremarkablepropertyofconvolutionisthateachtimeweconvolveafunctionwithaboxitssmoothnessincreases.WewillseethatconvolutioncanbeseenasÒmovingaverageÓAB-splinebasisfunctionofdegreecanbeobtainedbyconvolvingaB-splinebasisfunc-tionofdegreewiththeboxBox.Forexample,thebasisfunctionofdegree1isdeÞnedastheconvolutionofBoxwithitself.WeneedtocomputeBoxBoxGraphically,thisconvolutioncanbeevaluatedbyslidingoneboxfunctionalongthecoor-dinateaxisfromandkeepingthesecondboxÞxed(seeFigure4).Thevalueoftheconvolutionforagivenpositionofthesecondboxissimplytheareaundertheproductoftheboxes,whichisjustthelengthoftheintervalwherebothboxesarenon-zero.AtÞrstthetwographsdonothavecommonarea.Oncethemovingboxreaches0,thereisagrowingoverlapbetweentheareasofthegraphs.Thevalueoftheconvolutionincreasesuntil.Thentheoverlapstartsdecreasing,andthevalueoftheconvolutiondecreasesdowntozeroat.ThefunctionBoxBoxisasshowninFigure4.NowtaketheconvolutionofBoxandweobtain,thedegree2basisfunction.Wecancontinuefurtherandobtaindegree3B-spline,byconvolvingBox(Figure5).PropertiesofB-splinesisapiecewisepolynomialofdegree(eachconvolutionincreasesthedegreebyhasasupportoflength.WehaveseenthatBoxhasasupport1andeachconvolutionincreasesthesupportby1.
G22.3033-002:Lecture#2
Figure4:ThedeÞnitionofDegree1B-splinebasisfunctionthroughconvolutionofBoxfunc-tionwithitself.
124
6t32
3
2t2
1
2t32
3
2(4
+2(4
t)2
1
2(4
t)31
6(4
t)3
Figure5:Degree3B-splinebasisfunctionBoxcontinuousandeachconvolutionincreasessmoothnessby1.ThesetoffunctionsisafÞneinvariant.Thiscomesfromtheobservationthat
G22.3033-002:Lecture#2
(0,1,2)P(1,2,3)P(2,3,4)P(1,2,t)P(2,3,t)
(2,t,t)P(t,t,t)P(3,t,t)P(3,4,t)P(3,4,5)
3t
3t
3
2t
2t
3t
Figure6:BlossominginB-splineswhichcanbeprovedbyininductionobservingthatthispropertyholdsfortheboxfunc-tionandispreservedbytheconvolution.BlossominginB-splinesForacubicB-spline,ifif,3],thenwecanobtainthevalueoft,t,tfromthevaluesofasshowninFigure6.Forri,i+1]andcubicB-splines,weneedfourcontrolpoints,i,i+1)i,i+2)+3)