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

Public Member Functions

 PerlinNoiseGenerator (World world)
 
 PerlinNoiseGenerator (long seed)
 
 PerlinNoiseGenerator (Random rand)
 
double noise (double x, double y, double z)
 
- Public Member Functions inherited from org.bukkit.util.noise.NoiseGenerator
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 double getNoise (double x)
 
static double getNoise (double x, double y)
 
static double getNoise (double x, double y, double z)
 
static PerlinNoiseGenerator getInstance ()
 
static double getNoise (double x, int octaves, double frequency, double amplitude)
 
static double getNoise (double x, double y, int octaves, double frequency, double amplitude)
 
static double getNoise (double x, double y, double z, int octaves, double frequency, double amplitude)
 
- Static Public Member Functions inherited from org.bukkit.util.noise.NoiseGenerator
static int floor (double x)
 

Static Protected Attributes

static final int grad3 [][]
 

Additional Inherited Members

- Static Protected Member Functions inherited from org.bukkit.util.noise.NoiseGenerator
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 inherited from org.bukkit.util.noise.NoiseGenerator
final int perm [] = new int[512]
 
double offsetX
 
double offsetY
 
double offsetZ
 

Detailed Description

Generates noise using the "classic" perlin generator

See also
SimplexNoiseGenerator "Improved" and faster version with slighly different results

Definition at line 12 of file PerlinNoiseGenerator.java.

Constructor & Destructor Documentation

org.bukkit.util.noise.PerlinNoiseGenerator.PerlinNoiseGenerator ( World  world)

Creates a seeded perlin noise generator for the given world

Parameters
worldWorld to construct this generator for

Definition at line 48 of file PerlinNoiseGenerator.java.

References org.bukkit.World.getSeed().

48  {
49  this(new Random(world.getSeed()));
50  }
org.bukkit.util.noise.PerlinNoiseGenerator.PerlinNoiseGenerator ( long  seed)

Creates a seeded perlin noise generator for the given seed

Parameters
seedSeed to construct this generator for

Definition at line 57 of file PerlinNoiseGenerator.java.

57  {
58  this(new Random(seed));
59  }
org.bukkit.util.noise.PerlinNoiseGenerator.PerlinNoiseGenerator ( Random  rand)

Creates a seeded perlin noise generator with the given Random

Parameters
randRandom to construct with

Definition at line 66 of file PerlinNoiseGenerator.java.

66  {
67  offsetX = rand.nextDouble() * 256;
68  offsetY = rand.nextDouble() * 256;
69  offsetZ = rand.nextDouble() * 256;
70 
71  for (int i = 0; i < 256; i++) {
72  perm[i] = rand.nextInt(256);
73  }
74 
75  for (int i = 0; i < 256; i++) {
76  int pos = rand.nextInt(256 - i) + i;
77  int old = perm[i];
78 
79  perm[i] = perm[pos];
80  perm[pos] = old;
81  perm[i + 256] = perm[i];
82  }
83  }

Member Function Documentation

static PerlinNoiseGenerator org.bukkit.util.noise.PerlinNoiseGenerator.getInstance ( )
static

Gets the singleton unseeded instance of this generator

Returns
Singleton

Definition at line 126 of file PerlinNoiseGenerator.java.

126  {
127  return instance;
128  }
static double org.bukkit.util.noise.PerlinNoiseGenerator.getNoise ( double  x)
static

Computes and returns the 1D unseeded perlin noise for the given coordinates in 1D space

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

Definition at line 92 of file PerlinNoiseGenerator.java.

92  {
93  return instance.noise(x);
94  }
static double org.bukkit.util.noise.PerlinNoiseGenerator.getNoise ( double  x,
double  y 
)
static

Computes and returns the 2D unseeded perlin 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 104 of file PerlinNoiseGenerator.java.

104  {
105  return instance.noise(x, y);
106  }
static double org.bukkit.util.noise.PerlinNoiseGenerator.getNoise ( double  x,
double  y,
double  z 
)
static

Computes and returns the 3D unseeded perlin 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

Definition at line 117 of file PerlinNoiseGenerator.java.

117  {
118  return instance.noise(x, y, z);
119  }
static double org.bukkit.util.noise.PerlinNoiseGenerator.getNoise ( double  x,
int  octaves,
double  frequency,
double  amplitude 
)
static

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 183 of file PerlinNoiseGenerator.java.

183  {
184  return instance.noise(x, octaves, frequency, amplitude);
185  }
static double org.bukkit.util.noise.PerlinNoiseGenerator.getNoise ( double  x,
double  y,
int  octaves,
double  frequency,
double  amplitude 
)
static

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 198 of file PerlinNoiseGenerator.java.

198  {
199  return instance.noise(x, y, octaves, frequency, amplitude);
200  }
static double org.bukkit.util.noise.PerlinNoiseGenerator.getNoise ( double  x,
double  y,
double  z,
int  octaves,
double  frequency,
double  amplitude 
)
static

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 214 of file PerlinNoiseGenerator.java.

214  {
215  return instance.noise(x, y, z, octaves, frequency, amplitude);
216  }

Member Data Documentation

final int org.bukkit.util.noise.PerlinNoiseGenerator.grad3[][]
staticprotected
Initial value:
= {{1, 1, 0}, {-1, 1, 0}, {1, -1, 0}, {-1, -1, 0},
{1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1},
{0, 1, 1}, {0, -1, 1}, {0, 1, -1}, {0, -1, -1}}

Definition at line 13 of file PerlinNoiseGenerator.java.


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