3033002 Topics in Computer Graphics Lecture 2 Geometric Modeling New York University Bezier Curves and Bsplines Blossoming Lecture 2 16 September 2002 Lecturer Prof Denis Zorin Scribe Kranthi K Gade In this l ID: 62339
Download Pdf The PPT/PDF document "G Topics in Computer Graphics Lecture G..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
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(1t)2,3t2(1t),t3].Onewaytoderivethissetofbasisfunctionistolookattheexpansionof1=(1=(1Whythisbasis?WeshallseethatBeziercurveshaveanumberofniceproperties.BernsteinbasisisdeÞnedforany.For,thebasisisis(t),t]andforitisis(t)2,2t(1t),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)