public class Noise
extends java.lang.Object
FastNoise
or SeededNoise
, as well as static utility methods used throughout noise code.
Modifier and Type | Class and Description |
---|---|
static class |
Noise.Adapted3DFrom4D
Used to add an extra parameter to 3D noise, such as one based on rotation, time, or some non-spatial component.
|
static class |
Noise.Adapted3DFrom5D
Used to add extra parameters to 3D noise, such as those based on rotation, time, or some non-spatial component.
|
static class |
Noise.Basic1D
A very simple 1D noise implementation, because a full-blown Perlin or Simplex noise implementation is probably
overkill for 1D noise.
|
static class |
Noise.Exponential1D |
static class |
Noise.Exponential2D |
static class |
Noise.Exponential3D |
static class |
Noise.Exponential4D |
static class |
Noise.Exponential5D |
static class |
Noise.Exponential6D |
static class |
Noise.InverseLayered1D |
static class |
Noise.InverseLayered2D |
static class |
Noise.InverseLayered3D |
static class |
Noise.InverseLayered4D |
static class |
Noise.InverseLayered5D |
static class |
Noise.InverseLayered6D |
static class |
Noise.Layered1D |
static class |
Noise.Layered2D |
static class |
Noise.Layered3D |
static class |
Noise.Layered4D |
static class |
Noise.Layered5D |
static class |
Noise.Layered6D |
static class |
Noise.LayeredSpiral2D |
static class |
Noise.LayeredSpiral3D |
static class |
Noise.LayeredSpiral4D |
static class |
Noise.LayeredSpiral5D |
static class |
Noise.LayeredSpiral6D |
static class |
Noise.Maelstrom1D |
static class |
Noise.Maelstrom2D |
static class |
Noise.Maelstrom3D |
static class |
Noise.Maelstrom4D |
static class |
Noise.Maelstrom5D |
static class |
Noise.Maelstrom6D |
static interface |
Noise.Noise1D |
static interface |
Noise.Noise2D |
static interface |
Noise.Noise3D |
static interface |
Noise.Noise4D |
static interface |
Noise.Noise5D |
static interface |
Noise.Noise6D |
static class |
Noise.QuilezNoise
A hybrid between value and gradient noise that may be faster for 1D noise.
|
static class |
Noise.Ridged1D |
static class |
Noise.Ridged2D |
static class |
Noise.Ridged3D |
static class |
Noise.Ridged4D |
static class |
Noise.Ridged5D |
static class |
Noise.Ridged6D |
static class |
Noise.Scaled1D |
static class |
Noise.Scaled2D |
static class |
Noise.Scaled3D |
static class |
Noise.Scaled4D |
static class |
Noise.Scaled6D |
static class |
Noise.Seamless2D |
static class |
Noise.Slick2D |
static class |
Noise.Slick3D |
static class |
Noise.Slick4D |
static class |
Noise.Slick6D |
static class |
Noise.Sway1D |
static class |
Noise.Sway2D |
static class |
Noise.Turbulent2D |
static class |
Noise.Turbulent3D |
static class |
Noise.Turbulent4D |
static class |
Noise.Turbulent6D |
static class |
Noise.Viny2D |
static class |
Noise.Viny3D |
static class |
Noise.Viny4D |
static class |
Noise.Viny6D |
static class |
Noise.Warped1D |
static class |
Noise.Warped2D |
static class |
Noise.Warped3D |
static class |
Noise.Warped4D |
static class |
Noise.Warped5D |
static class |
Noise.Warped6D |
Modifier and Type | Field and Description |
---|---|
static SeededNoise |
alternate |
static double |
total |
Constructor and Description |
---|
Noise() |
Modifier and Type | Method and Description |
---|---|
static double |
cerp(double start,
double end,
double a)
Cubic-interpolates between start and end (valid doubles), with a between 0 (yields start) and 1 (yields end).
|
static float |
cerp(float start,
float end,
float a)
Cubic-interpolates between start and end (valid floats), with a between 0 (yields start) and 1 (yields end).
|
static double |
emphasize(double a)
Given a float
a from 0.0 to 1.0 (both inclusive), this gets a float that adjusts a to be closer to the
end points of that range (if less than 0.5, it gets closer to 0.0, otherwise it gets closer to 1.0). |
static double |
emphasizeSigned(double a)
Given a float
a from -1.0 to 1.0 (both inclusive), this gets a float that adjusts a to be closer to the
end points of that range (if less than 0, it gets closer to -1.0, otherwise it gets closer to 1.0). |
static double |
extreme(double a)
Given a double
a from 0.0 to 1.0 (both inclusive), this gets a double that adjusts a to be much closer to
the end points of that range (if less than 0.5, it gets closer to 0.0, otherwise it gets closer to 1.0). |
static double |
extremeSigned(double a)
Given a double
a from -1.0 to 1.0 (both inclusive), this gets a double that adjusts a to be much closer
to the end points of that range (if less than 0, it gets closer to -1.0, otherwise it gets closer to 1.0). |
static int |
fastCeil(double t)
Like
Math.ceil(double) , but returns an int. |
static int |
fastCeil(float t)
Like
Math.ceil(double) , but takes a float and returns an int. |
static int |
fastFloor(double t)
Like
Math.floor(double) , but returns an int. |
static int |
fastFloor(float t)
Like
Math.floor(double) , but takes a float and returns an int. |
static double |
lerp(double start,
double end,
double a)
Linear-interpolates between start and end (valid doubles), with a between 0 (yields start) and 1 (yields end).
|
static float |
lerp(float start,
float end,
float a)
Linear-interpolates between start and end (valid floats), with a between 0 (yields start) and 1 (yields end).
|
static long |
longFloor(double t)
Like
Math.floor(double) , but returns a long. |
static long |
longFloor(float t)
Like
Math.floor(double) , but takes a float and returns a long. |
static double |
querp(double start,
double end,
double a)
Quintic-interpolates between start and end (valid doubles), with a between 0 (yields start) and 1 (yields end).
|
static float |
querp(float start,
float end,
float a)
Quintic-interpolates between start and end (valid floats), with a between 0 (yields start) and 1 (yields end).
|
static double |
seamless1D(Noise.Noise2D noise,
double x,
double sizeX,
long seed)
Like
seamless2D(double[][], long, int, Noise4D) , but this produces 1D noise that "tiles" by repeating
its output every sizeX units that x increases or decreases by. |
static double[][] |
seamless2D(double[][] fill,
int seed,
int octaves)
Fills the given 2D array (modifying it) with noise, using values from -1.0 to 1.0, that is seamless on all
boundaries.
|
static double[][] |
seamless2D(double[][] fill,
long seed,
int octaves,
Noise.Noise4D generator)
Fills the given 2D array (modifying it) with noise, using values from -1.0 to 1.0, that is seamless on all
boundaries.
|
static double[][] |
seamless2D(int width,
int height,
int seed,
int octaves)
Produces a 2D array of noise with values from -1.0 to 1.0 that is seamless on all boundaries.
|
static double |
seamless2D(Noise.Noise4D noise,
double x,
double y,
double sizeX,
double sizeY,
long seed)
Like
seamless2D(double[][], long, int, Noise4D) , but this doesn't precalculate noise into an array,
instead calculating just one 2D point so that later calls with different x or y will tile seamlessly. |
static double[][][] |
seamless3D(double[][][] fill,
long seed,
int octaves)
Fills the given 3D array (modifying it) with noise, using values from -1.0 to 1.0, that is seamless on all
boundaries.
|
static double[][][] |
seamless3D(double[][][] fill,
long seed,
int octaves,
Noise.Noise6D generator)
Fills the given 3D array (modifying it) with noise, using values from -1.0 to 1.0, that is seamless on all
boundaries.
|
static float[][][] |
seamless3D(float[][][] fill,
long seed,
int octaves)
Fills the given 3D array (modifying it) with noise, using values from -1.0 to 1.0, that is seamless on all
boundaries.
|
static double[][][] |
seamless3D(int depth,
int width,
int height,
long seed,
int octaves)
Produces a 3D array of noise with values from -1.0 to 1.0 that is seamless on all boundaries.
|
static double |
seamless3D(Noise.Noise6D noise,
double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ,
long seed)
Like
seamless3D(double[][][], long, int, Noise6D) , but this doesn't precalculate noise into an array,
instead calculating just one 3D point so that later calls with different x, y, or z will tile seamlessly. |
public static final SeededNoise alternate
public static double total
public static long longFloor(double t)
Math.floor(double)
, but returns a long.
Doesn't consider "weird doubles" like INFINITY and NaN.
This is only faster than (int)Math.floor(t)
on Java 8 for supported desktop platforms.t
- the double to find the floor forpublic static long longFloor(float t)
Math.floor(double)
, but takes a float and returns a long.
Doesn't consider "weird floats" like INFINITY and NaN.
This is only faster than (int)Math.floor(t)
on Java 8 for supported desktop platforms.t
- the double to find the floor forpublic static int fastFloor(double t)
Math.floor(double)
, but returns an int.
Doesn't consider "weird doubles" like INFINITY and NaN.
This is only faster than (int)Math.floor(t)
on Java 8 for supported desktop platforms.t
- the float to find the floor forpublic static int fastFloor(float t)
Math.floor(double)
, but takes a float and returns an int.
Doesn't consider "weird floats" like INFINITY and NaN.t
- the float to find the floor forpublic static int fastCeil(double t)
Math.ceil(double)
, but returns an int.
Doesn't consider "weird doubles" like INFINITY and NaN.
This is only faster than (int)Math.ceil(t)
on Java 8 for supported desktop platforms.t
- the float to find the ceiling forpublic static int fastCeil(float t)
Math.ceil(double)
, but takes a float and returns an int.
Doesn't consider "weird floats" like INFINITY and NaN.
This is only faster than (int)Math.ceil(t)
on Java 8 for supported desktop platforms.t
- the float to find the ceiling forpublic static double cerp(double start, double end, double a)
querp(double, double, double)
), but slower (and smoother) than
lerp(double, double, double)
.start
- a valid doubleend
- a valid doublea
- a double between 0 and 1 inclusivepublic static float cerp(float start, float end, float a)
querp(float, float, float)
), but slower (and smoother) than
lerp(float, float, float)
.start
- a valid floatend
- a valid floata
- a float between 0 and 1 inclusivepublic static double querp(double start, double end, double a)
start
- a valid double, as in, not infinite or NaNend
- a valid double, as in, not infinite or NaNa
- a double between 0 and 1 inclusivepublic static float querp(float start, float end, float a)
start
- a valid float, as in, not infinite or NaNend
- a valid float, as in, not infinite or NaNa
- a float between 0 and 1 inclusivepublic static double lerp(double start, double end, double a)
start
- a valid double, as in, not infinite or NaNend
- a valid double, as in, not infinite or NaNa
- a double between 0 and 1 inclusivepublic static float lerp(float start, float end, float a)
start
- a valid float, as in, not infinite or NaNend
- a valid float, as in, not infinite or NaNa
- a float between 0 and 1 inclusivepublic static double emphasize(double a)
a
from 0.0 to 1.0 (both inclusive), this gets a float that adjusts a to be closer to the
end points of that range (if less than 0.5, it gets closer to 0.0, otherwise it gets closer to 1.0).a
- a float between 0.0f and 1.0f inclusivepublic static double emphasizeSigned(double a)
a
from -1.0 to 1.0 (both inclusive), this gets a float that adjusts a to be closer to the
end points of that range (if less than 0, it gets closer to -1.0, otherwise it gets closer to 1.0).
ClassicNoise
and JitterNoise
to increase the frequency of high and low results, which
improves the behavior of Noise.Ridged2D
and other Ridged noise when it uses those noise algorithms.a
- a float between -1.0f and 1.0f inclusivepublic static double extreme(double a)
a
from 0.0 to 1.0 (both inclusive), this gets a double that adjusts a to be much closer to
the end points of that range (if less than 0.5, it gets closer to 0.0, otherwise it gets closer to 1.0).a
- a double between 0.0 and 1.0 inclusivepublic static double extremeSigned(double a)
a
from -1.0 to 1.0 (both inclusive), this gets a double that adjusts a to be much closer
to the end points of that range (if less than 0, it gets closer to -1.0, otherwise it gets closer to 1.0).a
- a double between -1.0 and 1.0 inclusivepublic static double[][] seamless2D(int width, int height, int seed, int octaves)
seamless2D(double[][], int, int)
, which re-uses the array.width
- the width of the array to produce (the length of the outer layer of arrays)height
- the height of the array to produce (the length of the inner arrays)seed
- an int seed that affects the noise produced, with different seeds producing very different noiseoctaves
- how many runs of differently sized and weighted noise generations to apply to the same areadouble[width][height]
.public static double[][] seamless2D(double[][] fill, int seed, int octaves)
fill
- a 2D array of double; must be rectangular, so it's a good idea to create with new double[width][height]
or something similarseed
- an int seed that affects the noise produced, with different seeds producing very different noiseoctaves
- how many runs of differently sized and weighted noise generations to apply to the same areafill
, after assigning it with seamless-bounded noisepublic static double[][] seamless2D(double[][] fill, long seed, int octaves, Noise.Noise4D generator)
fill
- a 2D array of double; must be rectangular, so it's a good idea to create with new double[width][height]
or something similarseed
- an int seed that affects the noise produced, with different seeds producing very different noiseoctaves
- how many runs of differently sized and weighted noise generations to apply to the same areafill
, after assigning it with seamless-bounded noisepublic static double[][][] seamless3D(int depth, int width, int height, long seed, int octaves)
seamless3D(double[][][], long, int)
, which re-uses the
array instead of re-generating it.width
- the width of the array to produce (the length of the middle layer of arrays)height
- the height of the array to produce (the length of the innermost arrays)depth
- the depth of the array to produce (the length of the outermost layer of arrays)seed
- an int seed that affects the noise produced, with different seeds producing very different noiseoctaves
- how many runs of differently sized and weighted noise generations to apply to the same areadouble[depth][width][height]
.public static double[][][] seamless3D(double[][][] fill, long seed, int octaves)
fill
- a 3D array of double; must be rectangular, so it's a good idea to create with new double[depth][width][height]
or something similarseed
- an int seed that affects the noise produced, with different seeds producing very different noiseoctaves
- how many runs of differently sized and weighted noise generations to apply to the same areafill
, after assigning it with seamless-bounded noisepublic static double[][][] seamless3D(double[][][] fill, long seed, int octaves, Noise.Noise6D generator)
fill
- a 3D array of double; must be rectangular, so it's a good idea to create with new double[depth][width][height]
or something similarseed
- an int seed that affects the noise produced, with different seeds producing very different noiseoctaves
- how many runs of differently sized and weighted noise generations to apply to the same areafill
, after assigning it with seamless-bounded noisepublic static float[][][] seamless3D(float[][][] fill, long seed, int octaves)
fill
- a 3D array of double; must be rectangular, so it's a good idea to create with new double[depth][width][height]
or something similarseed
- an int seed that affects the noise produced, with different seeds producing very different noiseoctaves
- how many runs of differently sized and weighted noise generations to apply to the same areafill
, after assigning it with seamless-bounded noisepublic static double seamless1D(Noise.Noise2D noise, double x, double sizeX, long seed)
seamless2D(double[][], long, int, Noise4D)
, but this produces 1D noise that "tiles" by repeating
its output every sizeX
units that x
increases or decreases by. This doesn't precalculate an
array, instead calculating just one value so that later calls with different x will tile seamlessly.
noise
- a Noise2D implementation such as a SeededNoise
or FastNoise
x
- the x-coordinate to samplesizeX
- the range of x to generate before repeating; must be greater than 0seed
- the noise seed, as a longpublic static double seamless2D(Noise.Noise4D noise, double x, double y, double sizeX, double sizeY, long seed)
seamless2D(double[][], long, int, Noise4D)
, but this doesn't precalculate noise into an array,
instead calculating just one 2D point so that later calls with different x or y will tile seamlessly.noise
- a Noise4D implementation such as a SeededNoise
or FastNoise
x
- the x-coordinate to sampley
- the y-coordinate to samplesizeX
- the range of x to generate before repeating; must be greater than 0sizeY
- the range of y to generate before repeating; must be greater than 0seed
- the noise seed, as a longpublic static double seamless3D(Noise.Noise6D noise, double x, double y, double z, double sizeX, double sizeY, double sizeZ, long seed)
seamless3D(double[][][], long, int, Noise6D)
, but this doesn't precalculate noise into an array,
instead calculating just one 3D point so that later calls with different x, y, or z will tile seamlessly.noise
- a Noise6D implementation such as a SeededNoise
or FastNoise
x
- the x-coordinate to sampley
- the y-coordinate to samplez
- the z-coordinate to samplesizeX
- the range of x to generate before repeating; must be greater than 0sizeY
- the range of y to generate before repeating; must be greater than 0sizeZ
- the range of z to generate before repeating; must be greater than 0seed
- the noise seed, as a longCopyright © Eben Howard 2012–2022. All rights reserved.