com.jme3.terrain.heightmap
Class FaultHeightMap

java.lang.Object
  extended by com.jme3.terrain.heightmap.AbstractHeightMap
      extended by com.jme3.terrain.heightmap.FaultHeightMap
All Implemented Interfaces:
HeightMap

public class FaultHeightMap
extends AbstractHeightMap

Creates an heightmap based on the fault algorithm. Each iteration, a random line crossing the map is generated. On one side height values are raised, on the other side lowered.


Field Summary
static int FAULTSHAPE_CIRCLE
          A circular fault is created.
static int FAULTSHAPE_LINE
          A linear fault is created
static int FAULTTYPE_COSINE
          Values are lowered on one side, increased on the other, creating a cosine curve on the fault line
static int FAULTTYPE_LINEAR
          Values on one side are lowered, then increase lineary while crossing the fault line to the other side.
static int FAULTTYPE_SINE
          Value are lowered on both side, but increased on the fault line creating a smooth ridge on the fault line.
static int FAULTTYPE_STEP
          Values on one side are lowered, on the other side increased, creating a step at the fault line
 
Fields inherited from class com.jme3.terrain.heightmap.AbstractHeightMap
filter, heightData, heightScale, NORMALIZE_RANGE, size
 
Constructor Summary
FaultHeightMap(int size, int iterations, float minFaultHeight, float maxFaultHeight)
          Create an heightmap with linear step faults.
FaultHeightMap(int size, int iterations, int faultType, int faultShape, float minFaultHeight, float maxFaultHeight, long seed)
          Constructor creates the fault.
 
Method Summary
protected  void addCircleFault(float[][] tempBuffer, java.util.Random random, float faultHeight, float range)
           
protected  void addFault(float[][] tempBuffer, java.util.Random random)
           
protected  void addLineFault(float[][] tempBuffer, java.util.Random random, float faultHeight, float range)
           
protected  float calcHeight(float dist, java.util.Random random, float faultHeight, float range)
           
 int getFaultShape()
           
 int getFaultType()
           
 int getIterations()
           
 float getMaxFaultHeight()
           
 float getMaxRadius()
           
 float getMaxRange()
           
 float getMinFaultHeight()
           
 float getMinRadius()
           
 float getMinRange()
           
 long getSeed()
           
 boolean load()
          load populates the height map data.
 void setFaultShape(int faultShape)
           
 void setFaultType(int faultType)
           
 void setIterations(int iterations)
           
 void setMaxFaultHeight(float maxFaultHeight)
           
 void setMaxRadius(float maxRadius)
           
 void setMaxRange(float maxRange)
           
 void setMinFaultHeight(float minFaultHeight)
           
 void setMinRadius(float minRadius)
           
 void setMinRange(float minRange)
           
 void setSeed(long seed)
           
 
Methods inherited from class com.jme3.terrain.heightmap.AbstractHeightMap
erodeTerrain, findMinMaxHeights, flatten, getHeightMap, getInterpolatedHeight, getScaledHeightAtPoint, getScaledHeightMap, getSize, getTrueHeightAtPoint, normalizeTerrain, save, setHeightAtPoint, setHeightScale, setMagnificationFilter, setSize, smooth, smooth, unloadHeightMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FAULTTYPE_STEP

public static final int FAULTTYPE_STEP
Values on one side are lowered, on the other side increased, creating a step at the fault line

See Also:
Constant Field Values

FAULTTYPE_LINEAR

public static final int FAULTTYPE_LINEAR
Values on one side are lowered, then increase lineary while crossing the fault line to the other side. The fault line will be a inclined plane

See Also:
Constant Field Values

FAULTTYPE_COSINE

public static final int FAULTTYPE_COSINE
Values are lowered on one side, increased on the other, creating a cosine curve on the fault line

See Also:
Constant Field Values

FAULTTYPE_SINE

public static final int FAULTTYPE_SINE
Value are lowered on both side, but increased on the fault line creating a smooth ridge on the fault line.

See Also:
Constant Field Values

FAULTSHAPE_LINE

public static final int FAULTSHAPE_LINE
A linear fault is created

See Also:
Constant Field Values

FAULTSHAPE_CIRCLE

public static final int FAULTSHAPE_CIRCLE
A circular fault is created.

See Also:
Constant Field Values
Constructor Detail

FaultHeightMap

public FaultHeightMap(int size,
                      int iterations,
                      int faultType,
                      int faultShape,
                      float minFaultHeight,
                      float maxFaultHeight,
                      long seed)
               throws java.lang.Exception
Constructor creates the fault. For faulttype other than STEP, a range can be provided. For faultshape circle, min and max radii can be provided. Don't forget to reload the map if you have set parameters after the constructor call.

Parameters:
size - The size of the heightmap
iterations - Iterations to perform
faultType - Type of fault
faultShape - Shape of the fault -line or circle
minFaultHeight - Height modified on each side
maxFaultHeight - Height modified on each side
seed - A seed to feed the Random generator
Throws:
java.lang.Exception
See Also:
setFaultRange, setMinRadius, setMaxRadius

FaultHeightMap

public FaultHeightMap(int size,
                      int iterations,
                      float minFaultHeight,
                      float maxFaultHeight)
               throws java.lang.Exception
Create an heightmap with linear step faults.

Parameters:
size - size of heightmap
iterations - number of iterations
minFaultHeight - Height modified on each side
maxFaultHeight - Height modified on each side
Throws:
java.lang.Exception
Method Detail

load

public boolean load()
Description copied from interface: HeightMap
load populates the height map data. This is dependent on the subclass's implementation.

Returns:
true if the load was successful, false otherwise.

addFault

protected void addFault(float[][] tempBuffer,
                        java.util.Random random)

addLineFault

protected void addLineFault(float[][] tempBuffer,
                            java.util.Random random,
                            float faultHeight,
                            float range)

addCircleFault

protected void addCircleFault(float[][] tempBuffer,
                              java.util.Random random,
                              float faultHeight,
                              float range)

calcHeight

protected float calcHeight(float dist,
                           java.util.Random random,
                           float faultHeight,
                           float range)

getFaultShape

public int getFaultShape()

setFaultShape

public void setFaultShape(int faultShape)

getFaultType

public int getFaultType()

setFaultType

public void setFaultType(int faultType)

getIterations

public int getIterations()

setIterations

public void setIterations(int iterations)

getMaxFaultHeight

public float getMaxFaultHeight()

setMaxFaultHeight

public void setMaxFaultHeight(float maxFaultHeight)

getMaxRadius

public float getMaxRadius()

setMaxRadius

public void setMaxRadius(float maxRadius)

getMaxRange

public float getMaxRange()

setMaxRange

public void setMaxRange(float maxRange)

getMinFaultHeight

public float getMinFaultHeight()

setMinFaultHeight

public void setMinFaultHeight(float minFaultHeight)

getMinRadius

public float getMinRadius()

setMinRadius

public void setMinRadius(float minRadius)

getMinRange

public float getMinRange()

setMinRange

public void setMinRange(float minRange)

getSeed

public long getSeed()

setSeed

public void setSeed(long seed)