Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.util.noise.NoiseGenerator Class Referenceabstract
Inheritance diagram for org.bukkit.util.noise.NoiseGenerator:
org.bukkit.util.noise.PerlinNoiseGenerator org.bukkit.util.noise.SimplexNoiseGenerator

Public Member Functions

double noise (double x)
 
double noise (double x, double y)
 
abstract double noise (double x, double y, double z)
 
double noise (double x, int octaves, double frequency, double amplitude)
 
double noise (double x, int octaves, double frequency, double amplitude, boolean normalized)
 
double noise (double x, double y, int octaves, double frequency, double amplitude)
 
double noise (double x, double y, int octaves, double frequency, double amplitude, boolean normalized)
 
double noise (double x, double y, double z, int octaves, double frequency, double amplitude)
 
double noise (double x, double y, double z, int octaves, double frequency, double amplitude, boolean normalized)
 

Static Public Member Functions

static int floor (double x)
 

Static Protected Member Functions

static double fade (double x)
 
static double lerp (double x, double y, double z)
 
static double grad (int hash, double x, double y, double z)
 

Protected Attributes

final int perm [] = new int[512]
 
double offsetX
 
double offsetY
 
double offsetZ
 

Detailed Description

Base class for all noise generators

Definition at line 6 of file NoiseGenerator.java.

Member Function Documentation

static int org.bukkit.util.noise.NoiseGenerator.floor ( double  x)
static

Speedy floor, faster than (int)Math.floor(x)

Parameters
xValue to floor
Returns
Floored value

Definition at line 18 of file NoiseGenerator.java.

Referenced by org.bukkit.util.noise.SimplexNoiseGenerator.noise().

18  {
19  return x >= 0 ? (int) x : (int) x - 1;
20  }
double org.bukkit.util.noise.NoiseGenerator.noise ( double  x)

Computes and returns the 1D noise for the given coordinate in 1D space

Parameters
xX coordinate
Returns
Noise at given location, from range -1 to 1

Definition at line 43 of file NoiseGenerator.java.

Referenced by org.bukkit.util.noise.NoiseGenerator.noise().

43  {
44  return noise(x, 0, 0);
45  }
double org.bukkit.util.noise.NoiseGenerator.noise ( double  x,
double  y 
)

Computes and returns the 2D noise for the given coordinates in 2D space

Parameters
xX coordinate
yY coordinate
Returns
Noise at given location, from range -1 to 1

Definition at line 54 of file NoiseGenerator.java.

References org.bukkit.util.noise.NoiseGenerator.noise().

54  {
55  return noise(x, y, 0);
56  }
abstract double org.bukkit.util.noise.NoiseGenerator.noise ( double  x,
double  y,
double  z 
)
abstract

Computes and returns the 3D noise for the given coordinates in 3D space

Parameters
xX coordinate
yY coordinate
zZ coordinate
Returns
Noise at given location, from range -1 to 1
double org.bukkit.util.noise.NoiseGenerator.noise ( double  x,
int  octaves,
double  frequency,
double  amplitude 
)

Generates noise for the 1D coordinates using the specified number of octaves and parameters

Parameters
xX-coordinate
octavesNumber of octaves to use
frequencyHow much to alter the frequency by each octave
amplitudeHow much to alter the amplitude by each octave
Returns
Resulting noise

Definition at line 78 of file NoiseGenerator.java.

References org.bukkit.util.noise.NoiseGenerator.noise().

78  {
79  return noise(x, 0, 0, octaves, frequency, amplitude);
80  }
double org.bukkit.util.noise.NoiseGenerator.noise ( double  x,
int  octaves,
double  frequency,
double  amplitude,
boolean  normalized 
)

Generates noise for the 1D coordinates using the specified number of octaves and parameters

Parameters
xX-coordinate
octavesNumber of octaves to use
frequencyHow much to alter the frequency by each octave
amplitudeHow much to alter the amplitude by each octave
normalizedIf true, normalize the value to [-1, 1]
Returns
Resulting noise

Definition at line 93 of file NoiseGenerator.java.

References org.bukkit.util.noise.NoiseGenerator.noise().

93  {
94  return noise(x, 0, 0, octaves, frequency, amplitude, normalized);
95  }
double org.bukkit.util.noise.NoiseGenerator.noise ( double  x,
double  y,
int  octaves,
double  frequency,
double  amplitude 
)

Generates noise for the 2D coordinates using the specified number of octaves and parameters

Parameters
xX-coordinate
yY-coordinate
octavesNumber of octaves to use
frequencyHow much to alter the frequency by each octave
amplitudeHow much to alter the amplitude by each octave
Returns
Resulting noise

Definition at line 108 of file NoiseGenerator.java.

References org.bukkit.util.noise.NoiseGenerator.noise().

108  {
109  return noise(x, y, 0, octaves, frequency, amplitude);
110  }
double org.bukkit.util.noise.NoiseGenerator.noise ( double  x,
double  y,
int  octaves,
double  frequency,
double  amplitude,
boolean  normalized 
)

Generates noise for the 2D coordinates using the specified number of octaves and parameters

Parameters
xX-coordinate
yY-coordinate
octavesNumber of octaves to use
frequencyHow much to alter the frequency by each octave
amplitudeHow much to alter the amplitude by each octave
normalizedIf true, normalize the value to [-1, 1]
Returns
Resulting noise

Definition at line 124 of file NoiseGenerator.java.

References org.bukkit.util.noise.NoiseGenerator.noise().

124  {
125  return noise(x, y, 0, octaves, frequency, amplitude, normalized);
126  }
double org.bukkit.util.noise.NoiseGenerator.noise ( double  x,
double  y,
double  z,
int  octaves,
double  frequency,
double  amplitude 
)

Generates noise for the 3D coordinates using the specified number of octaves and parameters

Parameters
xX-coordinate
yY-coordinate
zZ-coordinate
octavesNumber of octaves to use
frequencyHow much to alter the frequency by each octave
amplitudeHow much to alter the amplitude by each octave
Returns
Resulting noise

Definition at line 140 of file NoiseGenerator.java.

References org.bukkit.util.noise.NoiseGenerator.noise().

140  {
141  return noise(x, y, z, octaves, frequency, amplitude, false);
142  }
double org.bukkit.util.noise.NoiseGenerator.noise ( double  x,
double  y,
double  z,
int  octaves,
double  frequency,
double  amplitude,
boolean  normalized 
)

Generates noise for the 3D coordinates using the specified number of octaves and parameters

Parameters
xX-coordinate
yY-coordinate
zZ-coordinate
octavesNumber of octaves to use
frequencyHow much to alter the frequency by each octave
amplitudeHow much to alter the amplitude by each octave
normalizedIf true, normalize the value to [-1, 1]
Returns
Resulting noise

Definition at line 157 of file NoiseGenerator.java.

References org.bukkit.util.noise.NoiseGenerator.noise().

157  {
158  double result = 0;
159  double amp = 1;
160  double freq = 1;
161  double max = 0;
162 
163  for (int i = 0; i < octaves; i++) {
164  result += noise(x * freq, y * freq, z * freq) * amp;
165  max += amp;
166  freq *= frequency;
167  amp *= amplitude;
168  }
169 
170  if (normalized) {
171  result /= max;
172  }
173 
174  return result;
175  }

The documentation for this class was generated from the following file: