org.xith3d.terrain.legacy.heightmap
Class MillerFractal

java.lang.Object
  extended by org.xith3d.terrain.legacy.heightmap.HeightMap
      extended by org.xith3d.terrain.legacy.heightmap.MillerFractal
All Implemented Interfaces:
java.io.Serializable, Terrain

public class MillerFractal
extends HeightMap
implements Terrain

Generates a heightmap using the "Miller" algorithm based on random fractals. It is an implementation of a varient of that alogirthm which is described by Paul Martz here: http://www.gameprogrammer.com/fractal.html.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.xith3d.terrain.legacy.heightmap.HeightMap
FLIP_STARTING, heightmap, ZIGZAG_COLS, ZIGZAG_ROWS
 
Constructor Summary
MillerFractal(int powerOfTwo, float startingHeight, float roughness, java.util.Random rg)
          Initialises the miller fractal generator.
 
Method Summary
 Geometry generateGeometry(float startX, float startY, float stepX, float stepY)
          Build 3D geometry from terrain
 void generateTerrain()
          generates terrain using the Miller algorithm
 
Methods inherited from class org.xith3d.terrain.legacy.heightmap.HeightMap
calculateCoords, calculateIndicies, flatten2DArray, generate2D, generate3D, generate3D, generateUTF, point2float, unIndex
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MillerFractal

public MillerFractal(int powerOfTwo,
                     float startingHeight,
                     float roughness,
                     java.util.Random rg)
Initialises the miller fractal generator.

Parameters:
powerOfTwo - number which will be raised to the power of to too calculate the width and height of the terrain
startingHeight - base height
roughness - how random, or "rough" the terrain will be
rg - Random number generator to use
Method Detail

generateTerrain

public void generateTerrain()
generates terrain using the Miller algorithm

Specified by:
generateTerrain in interface Terrain

generateGeometry

public Geometry generateGeometry(float startX,
                                 float startY,
                                 float stepX,
                                 float stepY)
Description copied from interface: Terrain
Build 3D geometry from terrain

Specified by:
generateGeometry in interface Terrain