Package org.pepsoft.util
Class PerlinNoise
java.lang.Object
org.pepsoft.util.PerlinNoise
- All Implemented Interfaces:
Serializable,Cloneable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()static floatgetLevelForPromillage(float promillage) static floatgetLevelForPromillage(int promillage) floatgetPerlinNoise(double x) Generates one dimensional noise.floatgetPerlinNoise(double x, double y) Generates two dimensional noise.floatgetPerlinNoise(double x, double y, double z) Generates three dimensional noise.longgetSeed()voidsetSeed(long seed)
-
Constructor Details
-
PerlinNoise
public PerlinNoise(long seed)
-
-
Method Details
-
getSeed
public long getSeed() -
setSeed
public void setSeed(long seed) -
getPerlinNoise
public float getPerlinNoise(double x) Generates one dimensional noise. The input value is normalised to be between 0 (inclusive) and 256 (exclusive), so the input should be constrained to be between those values for best results (otherwise the pattern will start to repeat).- Parameters:
x- The point for which to determine the noise value.- Returns:
- A noise value between -0.5 and 0.5.
-
getPerlinNoise
public float getPerlinNoise(double x, double y) Generates two dimensional noise. The input values are normalised to be between 0 (inclusive) and 256 (exclusive), so the input should be constrained to be between those values for best results (otherwise the pattern will start to repeat).- Parameters:
x- The X coordinate of the point for which to determine the noise value.y- The Y coordinate of the point for which to determine the noise value.- Returns:
- A noise value between -0.5 and 0.5.
-
getPerlinNoise
public float getPerlinNoise(double x, double y, double z) Generates three dimensional noise. The input values are normalised to be between 0 (inclusive) and 256 (exclusive), so the input should be constrained to be between those values for best results (otherwise the pattern will start to repeat).- Parameters:
x- The X coordinate of the point for which to determine the noise value.y- The Y coordinate of the point for which to determine the noise value.z- The Z coordinate of the point for which to determine the noise value.- Returns:
- A noise value between -0.5 and 0.5.
-
clone
-
getLevelForPromillage
public static float getLevelForPromillage(int promillage) -
getLevelForPromillage
public static float getLevelForPromillage(float promillage)
-