計(jì)算機(jī)畢設(shè)外文翻譯_第1頁(yè)
計(jì)算機(jī)畢設(shè)外文翻譯_第2頁(yè)
計(jì)算機(jī)畢設(shè)外文翻譯_第3頁(yè)
計(jì)算機(jī)畢設(shè)外文翻譯_第4頁(yè)
計(jì)算機(jī)畢設(shè)外文翻譯_第5頁(yè)
已閱讀5頁(yè),還剩8頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、County continuation records has examined and approved the draft, spirit, believe, comprehensive Yearbook of zhuanglang already prepared draft, entered the phase of evaluation. Civil air defense workPAGE County continuation records has examined and approved the draft, spirit, believe, comprehensive Y

2、earbook of zhuanglang already prepared draft, entered the phase of evaluation. Civil air defense workPAGE 6County continuation records has examined and approved the draft, spirit, believe, comprehensive Yearbook of zhuanglang already prepared draft, entered the phase of evaluation. Civil air defense

3、 workGenerating Random Fractal TerrainPart I: Generating Random Fractal TerrainIntroduction Ten years ago, I stumbled across the 1986 SIGGRAPH Proceedings and was awestruck by one paper in particular, entitled The Definition and Rendering of Terrain Maps by Gavin S. P. Miller 1 . It described a hand

4、ful of algorithms for generating fractal terrain, and the authors also introduce a new method which they considered to be an improvement.Initially I was impressed that these algorithms (even the algorithms considered flawed by the authors) could create such incredible landscape images! Then, upon re

5、ading the paper, I was floored by the simplicity of these algorithms.Ive been a fractal terrain addict ever since.The math behind the algorithm can get quite complex. However, completely understanding the math is not a prerequisite for grasping the algorithm. And thats good. Because if I had to expl

6、ain all the math to you before explaining the algorithm, wed never get to the algorithm. Besides, there is literally tons of material out there on the mathematical concepts involved in fractals. See the references at the end of this article for a good start.For the same reasons that I wont go into t

7、he math details, I cant include a broad overview of fractals and everything they can be used for. Instead, Im going describe the concepts behind fractal terrain generation, and give a focused and detailed description of my personal favorite algorithm: the diamond-square algorithm. Ill demonstrate ho

8、w to use this algorithm to statically tessellate an array of height data that can be used for geometric terrain data, terrain texture maps, and cloud texture maps.What can you do with a fractal terrain? I assume you already know that; thats why youre reading this. Random terrain maps are great for f

9、light simulators or making texture maps to use as a background (showing a distant mountain range, for example). The same algorithm that makes terrain can also be used to generate texture maps for partly cloudy skies.Before I go further, a disclaimer: I am not a game programmer. If you are reading th

10、is because you want algorithms for rendering terrain quickly, youve come to the wrong place. Ill only describe the process of generating the terrain model. How you render it is up to you.Self-Similarity The key concept behind any fractal is self-similarity. An object is said to be self-similar when

11、magnified subsets of the object look like (or identical to) the whole and to each other.2 Consider the human circulatory system. This is a fine example of self-similarity in nature. The same branching pattern is exhibited from the largest arteries and veins all the way down to the smallest capillari

12、es. If you didnt know you were using a microscope, you wouldnt be able to tell the difference between capillaries and arteries.Now consider a simple sphere. Is it self-similar? No. At significantly large magnification, it stops looking like a sphere altogether and starts looking like a flat plane. I

13、f you dont believe me, just take a look outside. Unless you happen to be in orbit while reading this, youll see no indication that the Earth is a sphere. A sphere is not self-similar. It is best described using traditional Euclidean geometry, rather than a fractal algorithm.Terrain falls into the se

14、lf-similar category. The jagged edge of a broken rock in the palm of your hand has the same irregularities as a ridgeline on a distant horizon. This allows us to use fractals to generate terrain which still looks like terrain, regardless of the scale in which it is displayed.A side note on self-simi

15、larity: In its strictest sense, it means self-identical, that is, exact miniature copies of itself are visible at increasingly small or large scales. I actually dont know of any self-identical fractals that exist in nature. But the Mandelbrot set is self-identical. I wont even go into describing the

16、 Mandelbrot set. Go dig up any of the references for more info.Midpoint Displacement in One Dimension The diamond-square algorithm, which I will describe later, uses a kind of midpoint-displacement algorithm in two dimensions. To help you get a grip on it, well look at it first in one dimension. One

17、-dimensional midpoint displacement is a great algorithm for drawing a ridgeline, as mountains might appear on a distant horizon. Heres how it works:Start with a single horizontal line segment.Repeat for a sufficiently large number of times Repeat over each line segment in the scene Find the midpoint

18、 of the line segment. Displace the midpoint in Y by a random amount. Reduce the range for random numbers. How much do you reduce the random number range? That depends on how rough you want your fractal. The more you reduce it each pass through the loop, the smoother the resulting ridgeline will be.

19、If you dont reduce the range very much, the resulting ridgeline will be very jagged. It turns out you can tie roughness to a constant; Ill explain how to do this later on.Lets look at an example. Here, we start with a line from -1.0 to 1.0 in X, with the Y value at each endpoint being zero. Initiall

20、y well set the random number range to be from -1.0 to 1.0 (arbitrary). So we generate a random number in that range, and displace the midpoint by that amount. After doing this, we have: Now the second time through the outer loop, we have two segments, each half the length of the original segment. Ou

21、r random number range is reduced by half, so it is now -0.5 to 0.5. We generate a random number in this range for each of the two midpoints. Heres the result:We shrink the range again; it is now -0.25 to 0.25. After displacing the four midpoints with random numbers in this range, we have:Two things

22、you should note about this.First, its recursive. Actually, it can be implemented quite naturally as an iterative routine. For this case, either recursive or iterative would do. It turns out that for the surface generation code, there are some advantages to using an iterative implementation over a re

23、cursive one. So for consistency, the accompanying sample code implements both the line and surface code as iterative.Second, its a very simple algorithm, yet it creates a very complex result. That is the beauty of fractal algorithms. A few simple instructions can create a very rich and detailed imag

24、e.Here I go off on a tangent: The realization that a small, simple set of instructions can create a complex image has lead to research in a new field known as fractal image compression. The idea is to store the simple, recursive instructions for creating the image rather than storing the image itsel

25、f. This works great for images which are truly fractal in nature, since the instructions take up much less space than the image itself. Chaos and Fractals, New Frontiers of Science 3 has a chapter and an appendix devoted to this topic and is a great read for any fractal nut in general.Back to realit

26、y.Without much effort, you can read the output of this function into a paint program and come up with something like this:This could be used as scenery outside a window, for example. The nice thing about it is that it wraps, so you can keep around one relatively small image and completely wrap a sce

27、ne with it. That is, if you dont mind seeing the same mountain in every direction.OK, before we go into 2D fractal surfaces, you need to know about the roughness constant. This is the value which will determine how much the random number range is reduced each time through the loop and, therefore, wi

28、ll determine the roughness of the resulting fractal. The sample code uses a floating-point number in the range 0.0 to 1.0 and calls it H. 2(-H) is therefore a number in the range 1.0 (for small H) to 0.5 (for large H). The random number range can be multiplied by this amount each time through the lo

29、op. With H set to 1.0, the random number range will be halved each time through the loop, resulting in a very smooth fractal. With H set to 0.0, the range will not be reduced at all, resulting in something quite jagged.Here are three ridgelines, each rendered with varying H valuesHeight MapsThe midp

30、oint displacement algorithm described above can be implemented using a one-dimensional array of height values which indicate the vertical location of each line segment vertex. This array is a one-dimensional height map. It maps its indices (X values) to height values (Y values).To simulate random te

31、rrain, we want to extrapolate this algorithm into 3D space, and to do so we need a two-dimensional array of height values which will map indices (X and Z values) into height values (Y values). Note that although our end goal here is to generate three-dimensional coordinates, the array only needs to

32、store the height (Y) values; the horizontal (X and Z) values can be generated on the fly as we parse through the array.By assigning a color to each height value, you could display a height map as an image. Here, high points in the terrain (large values) are represented by white, and low points (smal

33、l values) are represented by black:Rendering a height map this way is useful for generating cloud texture maps, which Ill discuss later. Such a representation could also be used to seed a height map.中文譯文:隨機(jī)分形地形的生成第一部分:生成隨機(jī)分形地形介紹十年前,我參加 1986 年 SIGGRAPH 活動(dòng), Gavin S. P. Miller 那篇題為 Definition and Rende

34、ring of Terrain Maps 的論文讓我充滿敬畏。該文描述了少數(shù)生成分形地形的算法,作者還介紹了一個(gè)他們認(rèn)為更先進(jìn)的新方法。開(kāi)始我被這些算法能夠生成難以置信的風(fēng)景圖所震驚?。ūM管這些算法被作者認(rèn)為“漏洞百出”)后來(lái),讀過(guò)論文,這些算法之簡(jiǎn)單將我完全打敗了。我從此成為一個(gè)分形地形迷。算法背后的數(shù)學(xué)可能相當(dāng)復(fù)雜。然而,完全理解這些數(shù)學(xué)并不是掌握這些算法的必要條件。很好,否則我得在解釋算法之前講解所有的數(shù),也許永遠(yuǎn)也講不到算法。此外,關(guān)于分形數(shù)學(xué)的文字材料數(shù)以噸計(jì),參見(jiàn)本文本的參考部分會(huì)有所幫助。同樣的原因,我不會(huì)深入到數(shù)學(xué)細(xì)節(jié),也不包括對(duì)分形的廣泛總覽及它們可被用來(lái)做的每樣?xùn)|西。相反,

35、我將描述分形地形生成背后的概念,并集中仔細(xì)講解我個(gè)人最喜歡的 ”diamond-square” 算法。我將演示如何使用這個(gè)算法靜態(tài)拼嵌高度數(shù)據(jù)數(shù)組,這些數(shù)據(jù)可用于幾何地形數(shù)據(jù)、地形紋理數(shù)據(jù)及云紋理映射。分形有什么用呢?假定你已經(jīng)知道,那正是你讀本文的原因。隨機(jī)地形圖對(duì)飛行模擬或制作背景紋理圖(如顯示一帶遠(yuǎn)山)十分有用。生成地形的算法也可用于生成部分云天的紋理圖。在繼續(xù)之前,申明一下:我不是游戲程序員。如果你為找到一個(gè)快速繪制地形的算法而讀此文,那你來(lái)錯(cuò)了地方。我只描述生成地形模型的過(guò)程。著色繪制是你自己的事。自相似任何分形最關(guān)鍵的概念是自相似。當(dāng)一個(gè)物體的一部分放大后看起來(lái)仍與整個(gè)物體一樣,那

36、這個(gè)物體就是自相似??紤]一下人體的循環(huán)系統(tǒng)。這是自然界中自相似的好例子。從最大的動(dòng)脈和靜脈分支直到最小的微血管,整個(gè)過(guò)程都顯現(xiàn)相同的分支模式。如果你不知道正在使用顯微鏡,將無(wú)法分辨微血管和大動(dòng)脈?,F(xiàn)在再考慮一個(gè)簡(jiǎn)單的球。它是自相似的嗎?不!大幅度放大后,它看起來(lái)不再象一個(gè)球,而象塊平板。如果你不相信,看看戶外。除非恰好你在太空軌道上看本文,否則將完全沒(méi)法看出地球是個(gè)球體。球體不是自相似的。它適用傳統(tǒng)的歐幾里德幾何描述而不是分形。地形屬于自相似范疇。手掌上的碎巖鋸齒狀邊緣與遠(yuǎn)處地平線邊的山脊有相同的不規(guī)則形狀。這使我們可以用分形來(lái)生成地形,不管顯示時(shí)怎么放大,它看起來(lái)仍然象地面。有關(guān)自相似請(qǐng)注意

37、:嚴(yán)格意義下,它意味著自分辨 (self-identical) ,即,自身精確的縮略拷貝在逐漸放大縮小時(shí)可見(jiàn)。我并不知道自然界存在任何自分辨分形。但 mandelbrot 集是自分辨的。我不會(huì)進(jìn)一步討論 Mandelbrot 集。到參考里找進(jìn)一步的信息。一維中點(diǎn)變換后邊要講的 diamond-square 算法,在兩維上使用一種中點(diǎn)變換算法。為幫助你了解個(gè)大概,我們先看一維情況。當(dāng)山脈出現(xiàn)在遠(yuǎn)處地平線處時(shí),一維中點(diǎn)變換是繪制山脊的好算法??纯此窃趺垂ぷ鞯模阂砸粭l水平地平線段開(kāi)始重復(fù)足夠多次對(duì)場(chǎng)景中的每條線段做找到線段的中點(diǎn)在 Y 方向上隨機(jī)移動(dòng)中點(diǎn)一段距離減小隨機(jī)數(shù)取值范圍將隨機(jī)數(shù)值域減速小多少呢?那取決于你想要分形的陡峭程度。每次循環(huán)減少的越多,所得山脊線就越平滑。但如果減得太多,則會(huì)有明顯的鋸齒感??梢源植诙却嬖谝粋€(gè)常量里。后面會(huì)解釋如何做。來(lái)

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論