;######################################################################## ;#----------------------------------------------------------------------# ;# # ;# BOOT-SECTOR FRACTAL LANDSCAPE (C) 1994 DYNO / GASTON. # ;# # ;#----------------------------------------------------------------------# ;######################################################################## ;#----------------------------------------------------------------------# ;# What is a fractal landscape ? # ;#----------------------------------------------------------------------# Fractal landscapes are an application of fractals in the field of representation of natural shapes, such as terrains, coastlines, river network, or mountains... Fractal landscapes are often generated using a technique called spacial subdivision. For magical reasons this results in surfaces that are similar in appearance to the earth terrain. The result of the process is a 2D table of heights that can be rendered as an image (for example a 2D map, but why not a 3D view with a hidden-surface removal) The simple method used is to take a polygon, divide it into smaller ones and move the new points up or down to give perturbations in the terrain and create an irregular shape. ;#----------------------------------------------------------------------# ;# To run the demo ... # ;#----------------------------------------------------------------------# This demo only runs on a RGB-monitor. To run this demo from the desktop you just have to click on FRACTAL.PRG to generate a new fractal landscape. To install this demo as a boot-sector, you have to use an extra utility, for example Booter2 from DNT Crew, that allows to install a program as a boot program on a floppy disk, and then install BOOTSECT.PRG on the disk. Reboot with the floppy disk and watch. ;#----------------------------------------------------------------------# ;# Credits ... # ;#----------------------------------------------------------------------# The credits for this boot-sector fractal landscape generator are : Idea and code : DYNO. ;#----------------------------------------------------------------------# ;# Some technical explanations ... # ;#----------------------------------------------------------------------# To create a fractal landscape, we are going to use a recursive process described here : At the beginning of the program, a big array (corresponding to the screen size) is divided into smaller square arrays, each vertex value of every square being initialized with a random value. Here is shown a square with the vertex values represented by a figure rounded by two parenthesis : (1)-----(2) | | | | | | (3)-----(4) At each step of the recursive process, each square is divided into 4 smaller squares (half the size of the square from the previous step) (1)--*--(2) | | | *---+---* | | | (3)--*--(4) Then, each new side value (here, a '*') is computed by taking the average value of the two opposite vertex values, then adding a random perturbation value (its amplitude decreasing with the square size). So, we obtain four new value : (1)--(5)--(2) | | | (6)---+---(8) | | | (3)--(7)--(4) The center value (here, a '+') is computed by taking the average value of the four side values, and adding a random perturbation value : (1)--(5)--(2) | | | (6)--(9)--(8) | | | (3)--(7)--(4) Then, the process is repeated until a square cannot be divided into four smaller squares. At the end, when all the values are generated, we only have to display the map with a visual algorithm, here the map is displayed in 2D on the screen, like a road map. ;#----------------------------------------------------------------------# ;# Greetings ... # ;#----------------------------------------------------------------------# The greetings go to Julia who began to explore a new mathematical field at the beginning of the century, and discovered its famous Julia sets, and also to Mandelbrot who rediscovered the fractals in 1975 with its also famous Mandelbrot set, and created this new and fascinating branch of computer science. ;#----------------------------------------------------------------------# ;# In conclusion ... # ;#----------------------------------------------------------------------# If you have any comment, remark, suggestion, just contact me at the address just above ... 28 August 1996, Dyno