hmi.math
Class PerlinNoise

java.lang.Object
  extended by hmi.math.PerlinNoise

public class PerlinNoise
extends Object

Author:
welberge Generates noise fluently interpolated through random points between some uppperlimit and lowerlimit

Field Summary
private static int DEFAULT_NR_OF_POINTS
           
private  float[] g
           
private static int randoms
           
 
Constructor Summary
PerlinNoise(float lowerLimit, float upperLimit)
          Constructor, creates DEFAULT_NR_OF_POINTS random points
PerlinNoise(int nr, float lowerLimit, float upperLimit)
          Constructor, creates nr random points
 
Method Summary
private  float getG(int index)
           
private  float getG(int index, int length)
           
 void initialize(float lowerLimit, float upperLimit)
          Initialize random points
 float noise(float t)
          Get the noise value at time t
 float noise(float t, int l)
          Get the noise value at time t, loop after l random points
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_NR_OF_POINTS

private static final int DEFAULT_NR_OF_POINTS
See Also:
Constant Field Values

g

private float[] g

randoms

private static int randoms
Constructor Detail

PerlinNoise

public PerlinNoise(int nr,
                   float lowerLimit,
                   float upperLimit)
Constructor, creates nr random points

Parameters:
nr - number of random points to generate
lowerLimit - lowest value for a random point
upperLimit - highest value for a random point

PerlinNoise

public PerlinNoise(float lowerLimit,
                   float upperLimit)
Constructor, creates DEFAULT_NR_OF_POINTS random points

Parameters:
lowerLimit - lowest value for a random point
upperLimit - highest value for a random point
Method Detail

initialize

public void initialize(float lowerLimit,
                       float upperLimit)
Initialize random points

Parameters:
lowerLimit - lowest value for a random point
upperLimit - highest value for a random point

getG

private float getG(int index)

getG

private float getG(int index,
                   int length)

noise

public float noise(float t)
Get the noise value at time t

Parameters:
t - time
Returns:
the noise value

noise

public float noise(float t,
                   int l)
Get the noise value at time t, loop after l random points

Parameters:
t - time
l - length
Returns:
the noise value