com.jmex.terrain.util
Class FaultFractalHeightMap

java.lang.Object
  extended by com.jmex.terrain.util.AbstractHeightMap
      extended by com.jmex.terrain.util.FaultFractalHeightMap

public class FaultFractalHeightMap
extends AbstractHeightMap

FaultFractalHeightMap creates a heightmap based on the Fault Formation fractal generation algorithm based on Jason Shankel's paper from "Game Programming Gems". Terrain is generated by simulating Earth quakes, where a random line is drawn through the heightmap and one side is lifted by a factor. This is then run through a FIR filter to simulate water errosion.

Version:
$Id: FaultFractalHeightMap.java 4133 2009-03-19 20:40:11Z blaine.dev $
Author:
Mark Powell

Field Summary
 
Fields inherited from class com.jmex.terrain.util.AbstractHeightMap
filter, heightData, heightScale, NORMALIZE_RANGE, size
 
Constructor Summary
FaultFractalHeightMap(int size, int iterations, int minDelta, int maxDelta, float filter)
          Constructor sets the attributes of the fault fractal system and generates the heightmap.
FaultFractalHeightMap(int size, int iterations, int minDelta, int maxDelta, float filter, long seed)
          Constructor sets the attributes of the fault fractal system and generates the heightmap.
 
Method Summary
 boolean load()
          load generates the heightfield using the Fault Fractal algorithm.
 void setIterations(int iterations)
          setIterations sets the number of faults to generated during the construction of the heightmap.
 void setMaxDelta(int maxDelta)
          setMaxDelta sets the maximum height value for the fault line varience.
 void setMinDelta(int minDelta)
          setMinDelta sets the minimum height value for the fault line varience.
 
Methods inherited from class com.jmex.terrain.util.AbstractHeightMap
erodeTerrain, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setHeightAtPoint, setHeightScale, setMagnificationFilter, setSize, unloadHeightMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FaultFractalHeightMap

public FaultFractalHeightMap(int size,
                             int iterations,
                             int minDelta,
                             int maxDelta,
                             float filter)
Constructor sets the attributes of the fault fractal system and generates the heightmap.

Parameters:
size - the size of the terrain to be generated.
iterations - the number of faults to generate.
minDelta - the minimum varience in the height increase between faults.
maxDelta - the maximum varience in the height increase between faults.
filter - the filter used for erosion. Filter can be between 0 and 1, where 0 is no filtering and 1 is extreme filtering. Suggested values are 0.2-0.4.
Throws:
JmeException - if size is not greater than zero, iterations is not greater than zero, minDelta is more than maxDelta and if filter is not between 0 and 1.

FaultFractalHeightMap

public FaultFractalHeightMap(int size,
                             int iterations,
                             int minDelta,
                             int maxDelta,
                             float filter,
                             long seed)
Constructor sets the attributes of the fault fractal system and generates the heightmap.

Parameters:
size - the size of the terrain to be generated.
iterations - the number of faults to generate.
minDelta - the minimum varience in the height increase between faults.
maxDelta - the maximum varience in the height increase between faults.
filter - the filter used for erosion. Filter can be between 0 and 1, where 0 is no filtering and 1 is extreme filtering. Suggested values are 0.2-0.4.
seed - randomizer seed
Throws:
JmeException - if size is not greater than zero, iterations is not greater than zero, minDelta is more than maxDelta and if filter is not between 0 and 1.
Method Detail

load

public boolean load()
load generates the heightfield using the Fault Fractal algorithm. load uses the latest attributes, so a call to load is recommended if attributes have changed using the set methods.

Specified by:
load in class AbstractHeightMap
Returns:
true if the load was successful, false otherwise.

setIterations

public void setIterations(int iterations)
setIterations sets the number of faults to generated during the construction of the heightmap.

Parameters:
iterations - the number of fault lines to generate.
Throws:
JmeException - if the number of faults is less than or equal to zero.

setMinDelta

public void setMinDelta(int minDelta)
setMinDelta sets the minimum height value for the fault line varience.

Parameters:
minDelta - the minimum height value for the fault line varience.
Throws:
JmeException - if minDelta is greater than maxDelta.

setMaxDelta

public void setMaxDelta(int maxDelta)
setMaxDelta sets the maximum height value for the fault line varience.

Parameters:
maxDelta - the maximum height value for the fault line varience.
Throws:
JmeException - if maxDelta is less than minDelta.