Class MillerFractal

  extended by org.xith3d.terrain.legacy.heightmap.HeightMap
      extended by org.xith3d.terrain.legacy.heightmap.MillerFractal
All Implemented Interfaces:, 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:

See Also:
Serialized Form

Field Summary
Fields inherited from class org.xith3d.terrain.legacy.heightmap.HeightMap
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


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

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


public void generateTerrain()
generates terrain using the Miller algorithm

Specified by:
generateTerrain in interface Terrain


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