Package org.bukkit.util.noise
Class NoiseGenerator
java.lang.Object
org.bukkit.util.noise.NoiseGenerator
- Direct Known Subclasses:
PerlinNoiseGenerator
Base class for all noise generators
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static double
fade
(double x) static int
floor
(double x) Speedy floor, faster than (int)Math.floor(x)protected static double
grad
(int hash, double x, double y, double z) protected static double
lerp
(double x, double y, double z) double
noise
(double x) Computes and returns the 1D noise for the given coordinate in 1D spacedouble
noise
(double x, double y) Computes and returns the 2D noise for the given coordinates in 2D spaceabstract double
noise
(double x, double y, double z) Computes and returns the 3D noise for the given coordinates in 3D spacedouble
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 parametersdouble
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 parametersdouble
noise
(double x, double y, int octaves, double frequency, double amplitude) Generates noise for the 2D coordinates using the specified number of octaves and parametersdouble
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 parametersdouble
noise
(double x, int octaves, double frequency, double amplitude) Generates noise for the 1D coordinates using the specified number of octaves and parametersdouble
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
-
Field Details
-
perm
protected final int[] perm -
offsetX
protected double offsetX -
offsetY
protected double offsetY -
offsetZ
protected double offsetZ
-
-
Constructor Details
-
NoiseGenerator
public NoiseGenerator()
-
-
Method Details
-
floor
public static int floor(double x) Speedy floor, faster than (int)Math.floor(x)- Parameters:
x
- Value to floor- Returns:
- Floored value
-
fade
protected static double fade(double x) -
lerp
protected static double lerp(double x, double y, double z) -
grad
protected static double grad(int hash, double x, double y, double z) -
noise
public double noise(double x) Computes and returns the 1D noise for the given coordinate in 1D space- Parameters:
x
- X coordinate- Returns:
- Noise at given location, from range -1 to 1
-
noise
public double noise(double x, double y) Computes and returns the 2D noise for the given coordinates in 2D space- Parameters:
x
- X coordinatey
- Y coordinate- Returns:
- Noise at given location, from range -1 to 1
-
noise
public abstract double noise(double x, double y, double z) Computes and returns the 3D noise for the given coordinates in 3D space- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinate- Returns:
- Noise at given location, from range -1 to 1
-
noise
public double noise(double x, int octaves, double frequency, double amplitude) Generates noise for the 1D coordinates using the specified number of octaves and parameters- Parameters:
x
- X-coordinateoctaves
- Number of octaves to usefrequency
- How much to alter the frequency by each octaveamplitude
- How much to alter the amplitude by each octave- Returns:
- Resulting noise
-
noise
public double 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:
x
- X-coordinateoctaves
- Number of octaves to usefrequency
- How much to alter the frequency by each octaveamplitude
- How much to alter the amplitude by each octavenormalized
- If true, normalize the value to [-1, 1]- Returns:
- Resulting noise
-
noise
public double 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:
x
- X-coordinatey
- Y-coordinateoctaves
- Number of octaves to usefrequency
- How much to alter the frequency by each octaveamplitude
- How much to alter the amplitude by each octave- Returns:
- Resulting noise
-
noise
public double 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:
x
- X-coordinatey
- Y-coordinateoctaves
- Number of octaves to usefrequency
- How much to alter the frequency by each octaveamplitude
- How much to alter the amplitude by each octavenormalized
- If true, normalize the value to [-1, 1]- Returns:
- Resulting noise
-
noise
public double 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:
x
- X-coordinatey
- Y-coordinatez
- Z-coordinateoctaves
- Number of octaves to usefrequency
- How much to alter the frequency by each octaveamplitude
- How much to alter the amplitude by each octave- Returns:
- Resulting noise
-
noise
public double 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:
x
- X-coordinatey
- Y-coordinatez
- Z-coordinateoctaves
- Number of octaves to usefrequency
- How much to alter the frequency by each octaveamplitude
- How much to alter the amplitude by each octavenormalized
- If true, normalize the value to [-1, 1]- Returns:
- Resulting noise
-