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

Public Member Functions

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)
 

Protected Member Functions

 OctaveGenerator (NoiseGenerator[] octaves)
 

Protected Attributes

final NoiseGenerator[] octaves
 
double xScale = 1
 
double yScale = 1
 
double zScale = 1
 

Detailed Description

Creates noise using unbiased octaves

Definition at line 6 of file OctaveGenerator.java.

Member Function Documentation

NoiseGenerator [] org.bukkit.util.noise.OctaveGenerator.getOctaves ( )

Gets a clone of the individual octaves used within this generator

Returns
Clone of the individual octaves

Definition at line 89 of file OctaveGenerator.java.

89  {
90  return octaves.clone();
91  }
double org.bukkit.util.noise.OctaveGenerator.getXScale ( )

Gets the scale used for each X-coordinates passed

Returns
X scale

Definition at line 35 of file OctaveGenerator.java.

35  {
36  return xScale;
37  }
double org.bukkit.util.noise.OctaveGenerator.getYScale ( )

Gets the scale used for each Y-coordinates passed

Returns
Y scale

Definition at line 53 of file OctaveGenerator.java.

53  {
54  return yScale;
55  }
double org.bukkit.util.noise.OctaveGenerator.getZScale ( )

Gets the scale used for each Z-coordinates passed

Returns
Z scale

Definition at line 71 of file OctaveGenerator.java.

71  {
72  return zScale;
73  }
double org.bukkit.util.noise.OctaveGenerator.noise ( double  x,
double  frequency,
double  amplitude 
)

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

Parameters
xX-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 102 of file OctaveGenerator.java.

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

102  {
103  return noise(x, 0, 0, frequency, amplitude);
104  }
double noise(double x, double frequency, double amplitude)
double org.bukkit.util.noise.OctaveGenerator.noise ( double  x,
double  frequency,
double  amplitude,
boolean  normalized 
)

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

Parameters
xX-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 116 of file OctaveGenerator.java.

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

116  {
117  return noise(x, 0, 0, frequency, amplitude, normalized);
118  }
double noise(double x, double frequency, double amplitude)
double org.bukkit.util.noise.OctaveGenerator.noise ( double  x,
double  y,
double  frequency,
double  amplitude 
)

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

Parameters
xX-coordinate
yY-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 130 of file OctaveGenerator.java.

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

130  {
131  return noise(x, y, 0, frequency, amplitude);
132  }
double noise(double x, double frequency, double amplitude)
double org.bukkit.util.noise.OctaveGenerator.noise ( double  x,
double  y,
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
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 145 of file OctaveGenerator.java.

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

145  {
146  return noise(x, y, 0, frequency, amplitude, normalized);
147  }
double noise(double x, double frequency, double amplitude)
double org.bukkit.util.noise.OctaveGenerator.noise ( double  x,
double  y,
double  z,
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
frequencyHow much to alter the frequency by each octave
amplitudeHow much to alter the amplitude by each octave
Returns
Resulting noise

Definition at line 160 of file OctaveGenerator.java.

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

160  {
161  return noise(x, y, z, frequency, amplitude, false);
162  }
double noise(double x, double frequency, double amplitude)
double org.bukkit.util.noise.OctaveGenerator.noise ( double  x,
double  y,
double  z,
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
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 176 of file OctaveGenerator.java.

176  {
177  double result = 0;
178  double amp = 1;
179  double freq = 1;
180  double max = 0;
181 
182  x *= xScale;
183  y *= yScale;
184  z *= zScale;
185 
186  for (NoiseGenerator octave : octaves) {
187  result += octave.noise(x * freq, y * freq, z * freq) * amp;
188  max += amp;
189  freq *= frequency;
190  amp *= amplitude;
191  }
192 
193  if (normalized) {
194  result /= max;
195  }
196 
197  return result;
198  }
void org.bukkit.util.noise.OctaveGenerator.setScale ( double  scale)

Sets the scale used for all coordinates passed to this generator.

This is the equivalent to setting each coordinate to the specified value.

Parameters
scaleNew value to scale each coordinate by

Definition at line 24 of file OctaveGenerator.java.

References org.bukkit.util.noise.OctaveGenerator.setXScale(), org.bukkit.util.noise.OctaveGenerator.setYScale(), and org.bukkit.util.noise.OctaveGenerator.setZScale().

24  {
25  setXScale(scale);
26  setYScale(scale);
27  setZScale(scale);
28  }
void org.bukkit.util.noise.OctaveGenerator.setXScale ( double  scale)

Sets the scale used for each X-coordinates passed

Parameters
scaleNew X scale

Definition at line 44 of file OctaveGenerator.java.

Referenced by org.bukkit.util.noise.OctaveGenerator.setScale().

44  {
45  xScale = scale;
46  }
void org.bukkit.util.noise.OctaveGenerator.setYScale ( double  scale)

Sets the scale used for each Y-coordinates passed

Parameters
scaleNew Y scale

Definition at line 62 of file OctaveGenerator.java.

Referenced by org.bukkit.util.noise.OctaveGenerator.setScale().

62  {
63  yScale = scale;
64  }
void org.bukkit.util.noise.OctaveGenerator.setZScale ( double  scale)

Sets the scale used for each Z-coordinates passed

Parameters
scaleNew Z scale

Definition at line 80 of file OctaveGenerator.java.

Referenced by org.bukkit.util.noise.OctaveGenerator.setScale().

80  {
81  zScale = scale;
82  }

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