计算机毕设外文翻译.docx
- 文档编号:30353397
- 上传时间:2023-08-13
- 格式:DOCX
- 页数:11
- 大小:77.44KB
计算机毕设外文翻译.docx
《计算机毕设外文翻译.docx》由会员分享,可在线阅读,更多相关《计算机毕设外文翻译.docx(11页珍藏版)》请在冰豆网上搜索。
计算机毕设外文翻译
计算机毕设外文翻译
GeneratingRandomFractalTerrain
PartI:
GeneratingRandomFractalTerrain
Introduction
Tenyearsago,Istumbledacrossthe1986SIGGRAPHProceedingsandwasawestruckbyonepaperinparticular,entitledTheDefinitionandRenderingofTerrainMapsbyGavinS.P.Miller1.Itdescribedahandfulofalgorithmsforgeneratingfractalterrain,andtheauthorsalsointroduceanewmethodwhichtheyconsideredtobeanimprovement.
InitiallyIwasimpressedthatthesealgorithms(eventhealgorithmsconsidered"flawed"bytheauthors)couldcreatesuchincrediblelandscapeimages!
Then,uponreadingthepaper,Iwasflooredbythesimplicityofthesealgorithms.
I'vebeenafractalterrainaddicteversince.
Themathbehindthealgorithmcangetquitecomplex.However,completelyunderstandingthemathisnotaprerequisiteforgraspingthealgorithm.Andthat'sgood.BecauseifIhadtoexplainallthemathtoyoubeforeexplainingthealgorithm,we'dnevergettothealgorithm.Besides,thereisliterallytonsofmaterialoutthereonthemathematicalconceptsinvolvedinfractals.Seethereferencesattheendofthisarticleforagoodstart.
ForthesamereasonsthatIwon'tgointothemathdetails,Ican'tincludeabroadoverviewoffractalsandeverythingtheycanbeusedfor.Instead,I'mgoingdescribetheconceptsbehindfractalterraingeneration,andgiveafocusedanddetaileddescriptionofmypersonalfavoritealgorithm:
the"diamond-square"algorithm.I'lldemonstratehowtousethisalgorithmtostaticallytessellateanarrayofheightdatathatcanbeusedforgeometricterraindata,terraintexturemaps,andcloudtexturemaps.
Whatcanyoudowithafractalterrain?
Iassumeyoualreadyknowthat;that'swhyyou'rereadingthis.Randomterrainmapsaregreatforflightsimulatorsormakingtexturemapstouseasabackground(showingadistantmountainrange,forexample).Thesamealgorithmthatmakesterraincanalsobeusedtogeneratetexturemapsforpartlycloudyskies.
BeforeIgofurther,adisclaimer:
Iamnota
smallestcapillaries.Ifyoudidn'tknowyouwereusingamicroscope,youwouldn'tbeabletotellthedifferencebetweencapillariesandarteries.
Nowconsiderasimplesphere.Isitself-similar?
No.Atsignificantlylargemagnification,itstopslookinglikeaspherealtogetherandstartslookinglikeaflatplane.Ifyoudon'tbelieveme,justtakealookoutside.Unlessyouhappentobeinorbitwhilereadingthis,you'llseenoindicationthattheEarthisasphere.Asphereisnotself-similar.ItisbestdescribedusingtraditionalEuclideangeometry,ratherthanafractalalgorithm.
Terrainfallsintothe"self-similar"category.Thejaggededgeofabrokenrockinthepalmofyourhandhasthesameirregularitiesasaridgelineonadistanthorizon.Thisallowsustousefractalstogenerateterrainwhichstilllooksliketerrain,regardlessofthescaleinwhichitisdisplayed.
Asidenoteonself-similarity:
Initsstrictestsense,itmeansself-identical,thatis,exactminiaturecopiesofitselfarevisibleatincreasinglysmallorlargescales.Iactuallydon'tknowofanyself-identicalfractalsthatexistinnature.ButtheMandelbrotsetisself-identical.Iwon'tevengointodescribingtheMandelbrotset.Godigupanyofthereferencesformoreinfo.
MidpointDisplacementinOneDimension
Thediamond-squarealgorithm,whichIwilldescribelater,usesakindofmidpoint-displacementalgorithmintwodimensions.Tohelpyougetagriponit,we'lllookatitfirstinonedimension.
One-dimensionalmidpointdisplacementisagreatalgorithmfordrawingaridgeline,asmountainsmightappearonadistanthorizon.Here'showitworks:
Startwithasinglehorizontallinesegment.
Repeatforasufficientlylargenumberoftimes{
Repeatovereachlinesegmentinthescene{
Findthemidpointofthelinesegment.
DisplacethemidpointinYbyarandomamount.
Reducetherangeforrandomnumbers.
}
}
Howmuchdoyoureducetherandomnumberrange?
Thatdependsonhowroughyouwantyourfractal.Themoreyoureduceiteachpassthroughtheloop,thesmoothertheresultingridgelinewillbe.Ifyoudon'treducetherangeverymuch,theresultingridgelinewillbeveryjagged.Itturnsoutyoucantieroughnesstoaconstant;I'llexplainhowtodothislateron.
Let'slookatanexample.Here,westartwithalinefrom-1.0to1.0inX,withtheYvalueateachendpointbeingzero.Initiallywe'llsettherandomnumberrangetobefrom-1.0to1.0(arbitrary).Sowegeneratearandomnumberinthatrange,anddisplacethemidpointbythatamount.Afterdoingthis,wehave:
Nowthesecondtimethroughtheouterloop,wehavetwosegments,eachhalfthelengthoftheoriginalsegment.Ourrandomnumberrangeisreducedbyhalf,soitisnow-0.5to0.5.Wegeneratearandomnumberinthisrangeforeachofthetwomidpoints.Here'stheresult:
Weshrinktherangeagain;itisnow-0.25to0.25.Afterdisplacingthefourmidpointswithrandomnumbersinthisrange,wehave:
Twothingsyoushouldnoteaboutthis.
First,it'srecursive.Actually,itcanbeimplementedquitenaturallyasaniterativeroutine.Forthiscase,eitherrecursiveoriterativewoulddo.Itturnsoutthatforthesurfacegenerationcode,therearesomeadvantagestousinganiterativeimplementationoverarecursiveone.Soforconsistency,theaccompanyingsamplecodeimplementsboththelineandsurfacecodeasiterative.
Second,it'saverysimplealgorithm,yetitcreatesaverycomplexresult.Thatisthebeautyoffractalalgorithms.Afewsimpleinstructionscancreateaveryrichanddetailedimage.
HereIgooffonatangent:
Therealizationthatasmall,simplesetofinstructionscancreateacompleximagehasleadtoresearchinanewfieldknownasfractalimagecompression.Theideaistostorethesimple,recursiveinstructionsforcreatingtheimageratherthanstoringtheimageitself.Thisworksgreatforimageswhicharetrulyfractalinnature,sincetheinstructionstakeupmuchlessspacethantheimageitself.ChaosandFractals,NewFrontiersofScience3hasachapterandanappendixdevotedtothistopicandisagreatreadforanyfractalnutingeneral.
Backtoreality.
Withoutmucheffort,youcanreadtheoutputofthisfunctionintoapaintprogramandcomeupwithsomethinglikethis:
Thiscouldbeusedassceneryoutsideawindow,forexample.Thenicethingaboutitisthatitwraps,soyoucankeeparoundonerelativelysmallimageandcompletelywrapascenewithit.Thatis,ifyoudon'tmindseeingthesamemountainineverydirection.
OK,beforewegointo2Dfractalsurfaces,youneedtoknowabouttheroughnessconstant.Thisisthevaluewhichwilldeterminehowmuchtherandomnumberrangeisreducedeachtimethroughtheloopand,therefore,willdeterminetheroughnessoftheresultingfractal.Thesamplecodeusesafloating-pointnumberintherange0.0to1.0andcallsitH.2(-H)isthereforeanumberintherange1.0(forsmallH)to0.5(forlargeH).Therandomnumberrangecanbemultipliedbythisamounteachtimethroughtheloop.WithHsetto1.0,therandomnumberrangewillbehalvedeachtimethroughtheloop,resultinginaverysmoothfractal.WithHsetto0.0,therangewillnotbereducedatall,resultinginsomethingquitejagged.
Herearethreeridgelines,eachrenderedwithvaryingHvalues
HeightMaps
Themidpointdisplacementalgorithmdescribedabovecanbeimplementedusingaone-dimensionalarrayofheightvalueswhichindicatetheverticallocationofeachlinesegmentvertex.Thisarrayisaone-dimensionalheightmap.Itmapsitsindices(Xvalues)toheightvalues(Yvalues).
Tosimulaterandomterrain,wewanttoextrapolatethisalgorithminto3Dspace,andtodosoweneedatwo-dimensionalarrayofheightvalueswhichwillmapindices(XandZvalues)intoheightvalues(Yvalues).Notethatalthoughourendgoalhereistogeneratethree-dimensionalcoordinates,thearrayonlyneedstostoretheheight(Y)values;thehorizontal(XandZ)valuescanbegeneratedontheflyasweparsethroughthearray.
Byassigningacolortoeachheightvalue,youcoulddisplayaheightmapasanimage.Here,highpointsintheterrain(largevalues)arerepresentedbywhite,andlowpoints(smallvalues)arerepresentedbyblack:
Renderingaheightmapthiswayisusefulforgeneratingcloudtexturemaps,whichI'lldiscusslater.Sucharepresentationcouldalsobeusedtoseedaheightmap.
中文译文:
随机分形地形的生成
第一部分:
生成随机分形地形
介绍
十年前,我参加1986年SIGGRAPH活动,GavinS.P.Miller那篇题为DefinitionandRenderingofTerrainMaps的论文让我充满敬畏。
该文描述了少数生成分形地形的算法,作者还介绍了一个他们认为更先进的新方法。
开始我被这些算法能够生成难以置信的风景图所震惊!
(尽管这些算法被作者认为“漏洞百出”)后来,读过论文,这些算法之简单将我完全打败了。
我从此成为一个分形地形迷。
算法背后的数学可能相当复杂。
然而,完全理解这些数学并不是掌握这些算法的必要条件。
很好,否则我得在解释算法之前讲解所有的数,也许永远也讲不到算法。
此外,关于分形数学的文字材料数以吨计,参见本文本的参考部分会有所帮助。
同样的原因,我不会深入到数学细节,也不包括对分形的广泛总览及它们可被用来做的每样东西。
相反,我将描述分形地形生成背后的概念,并集中仔细讲解我个人最喜欢的”diamond-square”算法。
我将演示如何使用这个算法静态拼嵌高度数据数组,这些数据可用于几何地形数据、地形纹理数据及云纹理映射。
分形有什么用呢?
假定你已经知道,那正是你读本文的原因。
随机地形图对飞行模拟或制作背景纹理图(如显示一带远山)十分有用。
生成地形的算法也可用于生成部分云天的纹理图。
在继续之前,申明一下:
我不是游戏程序员。
如果你为找到一个快速绘制地形的算法而读此文,那你来错了地方。
我只描述生成地形模型的过程。
着色绘制是你自己的事。
自相似
任何分形最关键的概念是自相似。
当一个物体的一部分放大后看起来仍与整个物体一样,那这个物体就是自相似。
考虑一下人体的循环系统。
这是自然界中自相似的好例子。
从最大的动脉和静脉分支直到最小的微血管,整个过程都显现相同的分支模式。
如果你不知道正在使用显微镜,将无法分辨微血管和大动脉。
现在再考虑一个简单的球。
它是自相似的吗?
不!
大幅度放大后,它看起来不再象一个球,而象块平板。
如果你不相信,看看户外。
除非恰好你在太空轨道上看本文,否则将完全没法看出地球是个球体。
球体不是自相似的。
它适用传统的欧几里德几何描述而不是分形。
地形属于自相似范畴。
手掌上的碎岩锯齿状边缘与远处地平线边的山脊有相同的不规则形状。
这使我们可以用分形来生成地形,不管显示时怎么放大,它看起来仍然象地面。
有关自相似请注意:
严格意义下,它意味着自分辨(self-identical),即,自身精确的缩略拷贝在逐渐放大缩小时可见。
我并不知道自然界存在任何自分辨分形。
但mandelbrot集是自分辨的。
我不会进一步讨论Mandelbrot集。
到参考里找进一步的信息。
一维中点变换
后边要讲的diamond-square算法,在两维上使用一种中点变换算法。
为帮助你了解个大概,我们先看一维情况。
当山脉出现在远处地平线处时,一维中点变换是绘制山脊的好算法。
看看它是怎么
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 外文 翻译