Package net.dermetfan.utils.math
Class Noise
java.lang.Object
net.dermetfan.utils.math.Noise
public abstract class Noise
extends java.lang.Object
provides noise algorithms
-
Constructor Summary
Constructors Constructor Description Noise()
-
Method Summary
Modifier and Type Method Description static float[][]
diamondSquare(int n, float smoothness, float range, boolean wrapX, boolean wrapY, boolean initializeRandomly, float init, int scaleX, int scaleY)
static float[][]
diamondSquare(int n, float smoothness, float range, boolean wrapX, boolean wrapY, float init, int scaleX, int scaleY)
static float[][]
diamondSquare(int n, float smoothness, float range, boolean wrapX, boolean wrapY, int scaleX, int scaleY)
static float[][]
diamondSquare(int n, float smoothness, float range, boolean wrapX, boolean wrapY, Function<Pair<java.lang.Float,java.lang.Float>,java.lang.Float> init, int scaleX, int scaleY)
static java.util.Random
getRandom()
static long
getSeed()
static boolean
isSeedEnabled()
static float[]
midpointDisplacement(float[] values, float range, float smoothness)
randomizes a given float array using the midpoint-displacement algorithmstatic float[][]
midpointDisplacement(int n, float smoothness, float range, boolean initializeRandomly, float init, int scaleX, int scaleY)
static float[][]
midpointDisplacement(int n, float smoothness, float range, float init, int scaleX, int scaleY)
static float[][]
midpointDisplacement(int n, float smoothness, float range, int scaleX, int scaleY)
static float[][]
midpointDisplacement(int n, float smoothness, float range, Function<Pair<java.lang.Float,java.lang.Float>,java.lang.Float> init, int scaleX, int scaleY)
static float
random(float start, float end)
static void
setSeed(long seed)
static void
setSeedEnabled(boolean seedEnabled)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Noise
public Noise()
-
-
Method Details
-
midpointDisplacement
public static float[] midpointDisplacement(float[] values, float range, float smoothness)randomizes a given float array using the midpoint-displacement algorithm- Parameters:
values
- the float array to randomizerange
- the range used for random valuessmoothness
- the smoothness of the transitions- Returns:
- the randomized float array
-
midpointDisplacement
public static float[][] midpointDisplacement(int n, float smoothness, float range, int scaleX, int scaleY)- See Also:
midpointDisplacement(int, float, float, boolean, net.dermetfan.utils.Function, int, int)
-
midpointDisplacement
public static float[][] midpointDisplacement(int n, float smoothness, float range, Function<Pair<java.lang.Float,java.lang.Float>,java.lang.Float> init, int scaleX, int scaleY)- See Also:
midpointDisplacement(int, float, float, boolean, net.dermetfan.utils.Function, int, int)
-
midpointDisplacement
public static float[][] midpointDisplacement(int n, float smoothness, float range, float init, int scaleX, int scaleY) -
midpointDisplacement
public static float[][] midpointDisplacement(int n, float smoothness, float range, boolean initializeRandomly, float init, int scaleX, int scaleY)- See Also:
midpointDisplacement(int, float, float, boolean, net.dermetfan.utils.Function, int, int)
-
diamondSquare
public static float[][] diamondSquare(int n, float smoothness, float range, boolean wrapX, boolean wrapY, Function<Pair<java.lang.Float,java.lang.Float>,java.lang.Float> init, int scaleX, int scaleY)- See Also:
diamondSquare(int, float, float, boolean, boolean, boolean, net.dermetfan.utils.Function, int, int)
-
diamondSquare
public static float[][] diamondSquare(int n, float smoothness, float range, boolean wrapX, boolean wrapY, int scaleX, int scaleY) -
diamondSquare
public static float[][] diamondSquare(int n, float smoothness, float range, boolean wrapX, boolean wrapY, float init, int scaleX, int scaleY) -
diamondSquare
public static float[][] diamondSquare(int n, float smoothness, float range, boolean wrapX, boolean wrapY, boolean initializeRandomly, float init, int scaleX, int scaleY)- Parameters:
init
- the value to initialize every coordinate with- See Also:
diamondSquare(int, float, float, boolean, boolean, boolean, net.dermetfan.utils.Function, int, int)
-
random
public static float random(float start, float end)- Returns:
- a random value between start (inclusive) and end (exclusive)
-
setSeedEnabled
public static void setSeedEnabled(boolean seedEnabled)- Parameters:
seedEnabled
- ifseed
should be used
-
isSeedEnabled
public static boolean isSeedEnabled()- Returns:
- the
seedEnabled
-
getSeed
public static long getSeed()- Returns:
- the
seed
-
setSeed
public static void setSeed(long seed)- Parameters:
seed
- theseed
to set
-
getRandom
public static java.util.Random getRandom()- Returns:
- the
random
-