Skip to content

err0/fractal-terrain-generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Random fractal terrain generator

online demo: http://qiao.github.com/fractal-terrain-generator/demo/

This program is based on the Diamond-Square algorithm. Check out http://gameprogrammer.com/fractal.html for a detailed description.

Usage

var terrain = generateTerrain(32, 32, 1.0);

generateTerrain receives three parameters:

  • width: Segments of the width of the terrain.
  • height: Segments of the height of the terrain.
  • smoothness: Smoothness of the terrain. Higher this value, smoother the terrain will be. Recommended value is 1.

The result terrain will be a (width + 1) x (height + 1) 2-dimensional array containing the elevations of each vertex. And each elevation will be between -1 and 1.

About

A random fractal terrain generator in javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%