Diamond squares algorithm
Appearance
![]() | It has been suggested that this article be merged into Diamond-square algorithm and Talk:Diamond-square algorithm. (Discuss) Proposed since October 2007. |
The diamond squares algorithm is used to create computer generated fractal landscapes. The idea was first introduced by Gavin S. P. Miller who described it as flawed. The algorithm starts with a 2D grid then randomly generates terrain height from four seed values arranged in a grid of points so that the entire plane is coveerd in squares. The algorithm is executed in two steps.
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 pattern of diamonds across the network.
- Then do the same with the diagonals of the diamonds and you should have a pattern of squares again.
- After X ireterations take the values and translate them into height dimensions.