Socket
Socket
Sign inDemoInstall

fractal-terrain-generator

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    fractal-terrain-generator

fractal terrain generator


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Install size
716 kB
Created
Weekly downloads
 

Readme

Source

Random fractal terrain generator

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

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

Usage

Browser

download http://qiao.github.com/fractal-terrain-generator/lib/terrain.js and include it in your html.

Node.js

npm install 
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 elevation of each vertex.

Keywords

FAQs

Last updated on 15 Feb 2012

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc