Jump to content

Diamond squares algorithm

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Extransit (talk | contribs) at 17:09, 26 April 2007. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

The diamon squares algorithm is used to creat computer generated fractal terrain. The idea was first introduced by Gavin S. P. Miller who described it as flawd. The algorithm starts with a 2D grid then randomly generates terrain heigh from four seed values aranged in a grid of points so that the entire plane is coverd in squares. The diamond squares is a two step algorythm.

Steps

  • Taking the four seed points that are arranged in a square calculate a new vale where the diagonals would cross by averaging the values of the four points and adding a random amount. There should now be a patter of diamonds across the network.
  • Then do the same with the diagonals of the diamonds and you should have a patter of squares again.

after X ireterations take the valeus and translate them into hight demoninations.

sources

GameProgrammer.com[www.gameprogrammer.com/fractal.html]