Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.util.noise.SimplexOctaveGenerator Class Reference
Inheritance diagram for org.bukkit.util.noise.SimplexOctaveGenerator:
org.bukkit.util.noise.OctaveGenerator

Public Member Functions

 SimplexOctaveGenerator (World world, int octaves)
 
 SimplexOctaveGenerator (long seed, int octaves)
 
 SimplexOctaveGenerator (Random rand, int octaves)
 
void setScale (double scale)
 
double getWScale ()
 
void setWScale (double scale)
 
double noise (double x, double y, double z, double w, double frequency, double amplitude)
 
double noise (double x, double y, double z, double w, double frequency, double amplitude, boolean normalized)
 
- Public Member Functions inherited from org.bukkit.util.noise.OctaveGenerator
void setScale (double scale)
 
double getXScale ()
 
void setXScale (double scale)
 
double getYScale ()
 
void setYScale (double scale)
 
double getZScale ()
 
void setZScale (double scale)
 
NoiseGenerator[] getOctaves ()
 
double noise (double x, double frequency, double amplitude)
 
double noise (double x, double frequency, double amplitude, boolean normalized)
 
double noise (double x, double y, double frequency, double amplitude)
 
double noise (double x, double y, double frequency, double amplitude, boolean normalized)
 
double noise (double x, double y, double z, double frequency, double amplitude)
 
double noise (double x, double y, double z, double frequency, double amplitude, boolean normalized)
 

Additional Inherited Members

- Protected Member Functions inherited from org.bukkit.util.noise.OctaveGenerator
 OctaveGenerator (NoiseGenerator[] octaves)
 
- Protected Attributes inherited from org.bukkit.util.noise.OctaveGenerator
final NoiseGenerator[] octaves
 
double xScale = 1
 
double yScale = 1
 
double zScale = 1
 

Detailed Description

Creates simplex noise through unbiased octaves

Definition at line 9 of file SimplexOctaveGenerator.java.

Constructor & Destructor Documentation

org.bukkit.util.noise.SimplexOctaveGenerator.SimplexOctaveGenerator ( World  world,
int  octaves 
)

Creates a simplex octave generator for the given world

Parameters
worldWorld to construct this generator for
octavesAmount of octaves to create

Definition at line 18 of file SimplexOctaveGenerator.java.

References org.bukkit.World.getSeed().

18  {
19  this(new Random(world.getSeed()), octaves);
20  }
org.bukkit.util.noise.SimplexOctaveGenerator.SimplexOctaveGenerator ( long  seed,
int  octaves 
)

Creates a simplex octave generator for the given world

Parameters
seedSeed to construct this generator for
octavesAmount of octaves to create

Definition at line 28 of file SimplexOctaveGenerator.java.

28  {
29  this(new Random(seed), octaves);
30  }
org.bukkit.util.noise.SimplexOctaveGenerator.SimplexOctaveGenerator ( Random  rand,
int  octaves 
)

Creates a simplex octave generator for the given Random

Parameters
randRandom object to construct this generator for
octavesAmount of octaves to create

Definition at line 38 of file SimplexOctaveGenerator.java.

38  {
39  super(createOctaves(rand, octaves));
40  }

Member Function Documentation

double org.bukkit.util.noise.SimplexOctaveGenerator.getWScale ( )

Gets the scale used for each W-coordinates passed

Returns
W scale

Definition at line 53 of file SimplexOctaveGenerator.java.

53  {
54  return wScale;
55  }
double org.bukkit.util.noise.SimplexOctaveGenerator.noise ( double  x,
double  y,
double  z,
double  w,
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
wW-coordinate
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 SimplexOctaveGenerator.java.

78  {
79  return noise(x, y, z, w, frequency, amplitude, false);
80  }
double noise(double x, double y, double z, double w, double frequency, double amplitude)
double org.bukkit.util.noise.SimplexOctaveGenerator.noise ( double  x,
double  y,
double  z,
double  w,
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
wW-coordinate
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 95 of file SimplexOctaveGenerator.java.

95  {
96  double result = 0;
97  double amp = 1;
98  double freq = 1;
99  double max = 0;
100 
101  x *= xScale;
102  y *= yScale;
103  z *= zScale;
104  w *= wScale;
105 
106  for (NoiseGenerator octave : octaves) {
107  result += ((SimplexNoiseGenerator) octave).noise(x * freq, y * freq, z * freq, w * freq) * amp;
108  max += amp;
109  freq *= frequency;
110  amp *= amplitude;
111  }
112 
113  if (normalized) {
114  result /= max;
115  }
116 
117  return result;
118  }
void org.bukkit.util.noise.SimplexOctaveGenerator.setWScale ( double  scale)

Sets the scale used for each W-coordinates passed

Parameters
scaleNew W scale

Definition at line 62 of file SimplexOctaveGenerator.java.

62  {
63  wScale = scale;
64  }

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