WorstCase Versus Average Case Complexity of RaySho

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Worst-CaseVersusAverageCaseComplexityofRay-ShootingLaszloSzirmay-Kalos,GaborMartonDepartmentofControlEngineeringandInformationTechnology,TechnicalUniversityofBudapest,Budapest,M}uegyetemrkp.11,H-1111,HUNGARYszirmay@fsz.bme.huAbstract:Thispaperexaminesworst-caseandaverage-casecomplexitymea-suresofray-shootingalgorithmsinordertondtheanswertothequestionwhycomputergraphicspractitionerspreferheuristicmethodstoextensivelystudiedworst-caseoptimalalgorithms.Itdemonstratesthatray-shootingrequiresatleastlogarithmictimeintheworst-caseanddiscussesthestrategieshowtodesignsuchworst-caseoptimalalgorithms.Italsoexaminesthelower-boundsofstoragecom-plexityoflogarithmic-timealgorithmsandconcludesthatlogarithmictimehasveryhighpriceintermsofrequiredstorage.Inordertondaverage-casemea-sures,aprobabilisticmodelofthesceneisestablished.Weconcludethatalgo-rithmsoptimizedfortheaverage-casearenotonlymuchsimplertoimplement,buthavemoderatestoragerequirementandcanevenrunfasterforthemajorityofproblems.1IntroductionComputergraphicsexaminesthelight-objectinteractionofsurfacesin3Dspace.Inordertodeterminethereectedlightofasurfacepoint,theobjectsthatradiatelightontothispointmustbeknown.Forasingledirection,thisrequirestheemanationofahalf-line|calledray|fromthesurfacepointandthecomputationoftheobjectthatisrstintersectedbythisray.1Thisfundamentalgeometricproblemiscalledray-shooting.Forthecompletesolutionoftherenderingproblem,alotofraysshouldbeshotandtraced,thusitisworthpreprocessingthesceneintoadatastructurethatmakesray-shootingmoreeective.Frompracticalpointofview,eectivesolutionmeansinventingtrickyalgorithmsanddemonstratingbysimulationthatthesealgorithmsarereallyfasterfortheexaminedtestcases.Fromtheoreticalpointofview,however,wemustformallyprovethatanalgorithmhasbettercomplexitycharacter-isticsthantheothers.Complexitymeasuresexpresstherateofincreaseoftherequiredtimeandmemoryspaceasthesizeoftheproblemgrows.Thesizeoftheproblemisthenumberoftheobjectsinthescenefortheray-shootingproblem.Inthispaperthenumberofobjects,computationtimeandrequiredstoragearedenotedbylettern,T(n)andS(n)respectively.ThetimeandspacecomplexitiesimposeconstraintsonthefunctionsT(n)andS(n).Afunctiong(n)issaidtobeinO(f(n))ifthereexistpositivecon-stantscandNsothatg(n)cf(n)ifnN.ThusnotationOdescribesanupperbound.Notation,ontheotherhand,denesalowerbound:afunctiong(n)isin(f(n))ifthereexistpositiveconstantscandNsothatg(n)cf(n)ifnN.Finally,ifg(n)isbothinO(f(n))andin(f(n)),theng(n)issaidtobein(f(n)).Themainobjectiveofcomplexityanalysisistondalgorithmsthathavereasonableresourcerequirementsinthisasymptoticsense.Therequiredtimeisexpressedbythenumberofconstanttimeoperationsneededtocompletethealgorithm.Beforecarryingoutsuchananalysis,wehavetodenewhatkindofoperationscanbeusedtodenethealgorithm.Inthegenerallyacceptedalgebraicdecisiontreemodel,thefollowingoperationtypeisallowed:analgebraicfunctionisevaluatedandaccordingtoitsresultadeci-sionismadetoselectthenextoperation.Inthisframework,thecomputationcanbevisualizedbyabinarytreethatisdividedintotwobranchesbyeverysingledecision(thisiswhythemodeliscalledthealgebraicdecisiontreemodel).Intheclassicalapproachalgorithmsareoptimizedfortheworstcase,thuscomplexitymeasuresalsoexpresstheresourcerequirementsoftheworstarrangementofinputofagivensize.Thustheworst-casecomplexitymeasureis:T(n)=maxo1;:::;on2Otn(o1;:::;on);(1)2whereoirepresentstheparametersetdeningobjectiinthescene.Thevectoro1;:::;onofobjectparametersrepresentstheinputofthealgorithmandisalsocalledtheinputconguration.Worst-casecomplexitymeansthatthecomputationtimeandspacemustbebelowthegivenlimitsforanyinputcongurationofgivensize.Computergraphicsalgorithmsoptimizedfortheworstcasewereusuallybornintheframeworkofcomputationalgeometrywhichworkswithconstructssuchashyperplanes,cuttings,etc.,thusitusuallyrestrictsthetypeofobjectstothosethatareboundedbyplanarfaces.Thepracticeofcomputergraphics,ontheotherhand,hasproduceditsowntechniques,thatcanbecalledheuristicmethods.Theseheuristicmethodsdonotaimatworst-caseoptimizationbutratheraimatoptimizingfortheaveragecase.Intheframeworkofaveragecasecomplexityevaluation,algorithmsareoptimizedforthemajorityofthepossibleinputsnotfortheworstofthem.Moreprecisely,thecomplexitymeasurewillbetheexpectedvalueoftherunningtimeinsteadofthemaximumrunningtime.Iftheso-lutionforaninputcongurationtakesverylongtime,butthiscongurationhasveryloworevenzeroprobability,thenthisdoesnotmaketoomuchdierenceintheaveragecasecomplexityofthealgorithm.Thusthedenitionoftheaverage-casecomplexitymeasureis:T(n)=E[tn]=Zo12OZon2Otn(o1;:::;on)fn(o1;:::;on)do1don;(2)whereoiistheparametersetofobjectiasbeforeandfnistheprobabilitydensityofthepossibleinputcongurations.Thenaivesolutionoftheray-shootingproblem,wheneachobjectistriedtobeintersected,andthenthenearestintersectionisretained,requiresob-viouslylineartimebothintheworst-caseandintheaverage-case.However,havingpreprocessedtheobjectspaceintoasophisticateddatastructure,thisproblemcanbesolvedmoreeectively.2PreviousworkOneofth

1 / 36
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功