Package net.paulhertz.pixelaudio

# Class OpenSimplex2

java.lang.Object
net.paulhertz.pixelaudio.OpenSimplex2

public class OpenSimplex2 extends Object
K.jpg's OpenSimplex 2, faster variant from https://github.com/KdotJPG/OpenSimplex2

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `private static final double`
  `FALLBACK_ROTATE_3D`
  `private static float[]`
  `GRADIENTS_2D`
  `private static float[]`
  `GRADIENTS_3D`
  `private static float[]`
  `GRADIENTS_4D`
  `private static final long`
  `HASH_MULTIPLIER`
  `private static final float`
  `LATTICE_STEP_4D`
  `private static final int`
  `N_GRADS_2D`
  `private static final int`
  `N_GRADS_2D_EXPONENT`
  `private static final int`
  `N_GRADS_3D`
  `private static final int`
  `N_GRADS_3D_EXPONENT`
  `private static final int`
  `N_GRADS_4D`
  `private static final int`
  `N_GRADS_4D_EXPONENT`
  `private static final double`
  `NORMALIZER_2D`
  `private static final double`
  `NORMALIZER_3D`
  `private static final double`
  `NORMALIZER_4D`
  `private static final long`
  `PRIME_W`
  `private static final long`
  `PRIME_X`
  `private static final long`
  `PRIME_Y`
  `private static final long`
  `PRIME_Z`
  `private static final double`
  `ROOT2OVER2`
  `private static final double`
  `ROOT3OVER3`
  `private static final double`
  `ROTATE_3D_ORTHOGONALIZER`
  `private static final float`
  `RSQUARED_2D`
  `private static final float`
  `RSQUARED_3D`
  `private static final float`
  `RSQUARED_4D`
  `private static final long`
  `SEED_FLIP_3D`
  `private static final long`
  `SEED_OFFSET_4D`
  `private static final double`
  `SKEW_2D`
  `private static final float`
  `SKEW_4D`
  `private static final double`
  `UNSKEW_2D`
  `private static final float`
  `UNSKEW_4D`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OpenSimplex2()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `private static int`
  `fastFloor(double x)`
  `private static int`
  `fastRound(double x)`
  `private static float`
  `grad(long seed, long xsvp, long ysvp, float dx, float dy)`
  `private static float`
  `grad(long seed, long xrvp, long yrvp, long zrvp, float dx, float dy, float dz)`
  `private static float`
  `grad(long seed, long xsvp, long ysvp, long zsvp, long wsvp, float dx, float dy, float dz, float dw)`
  `static float`
  `noise2(long seed, double x, double y)`
  2D Simplex noise, standard lattice orientation.
  `static float`
  `noise2_ImproveX(long seed, double x, double y)`
  2D Simplex noise, with Y pointing down the main diagonal.
  `private static float`
  `noise2_UnskewedBase(long seed, double xs, double ys)`
  2D Simplex noise base.
  `static float`
  `noise3_Fallback(long seed, double x, double y, double z)`
  3D OpenSimplex2 noise, fallback rotation option Use noise3_ImproveXY or noise3_ImproveXZ instead, wherever appropriate.
  `static float`
  `noise3_ImproveXY(long seed, double x, double y, double z)`
  3D OpenSimplex2 noise, with better visual isotropy in (X, Y).
  `static float`
  `noise3_ImproveXZ(long seed, double x, double y, double z)`
  3D OpenSimplex2 noise, with better visual isotropy in (X, Z).
  `private static float`
  `noise3_UnrotatedBase(long seed, double xr, double yr, double zr)`
  Generate overlapping cubic lattices for 3D OpenSimplex2 noise.
  `static float`
  `noise4_Fallback(long seed, double x, double y, double z, double w)`
  4D OpenSimplex2 noise, fallback lattice orientation.
  `static float`
  `noise4_ImproveXY_ImproveZW(long seed, double x, double y, double z, double w)`
  4D OpenSimplex2 noise, with XY and ZW forming orthogonal triangular-based planes.
  `static float`
  `noise4_ImproveXYZ(long seed, double x, double y, double z, double w)`
  4D OpenSimplex2 noise, with XYZ oriented like noise3_Fallback and W for an extra degree of freedom.
  `static float`
  `noise4_ImproveXYZ_ImproveXY(long seed, double x, double y, double z, double w)`
  4D OpenSimplex2 noise, with XYZ oriented like noise3_ImproveXY and W for an extra degree of freedom.
  `static float`
  `noise4_ImproveXYZ_ImproveXZ(long seed, double x, double y, double z, double w)`
  4D OpenSimplex2 noise, with XYZ oriented like noise3_ImproveXZ and W for an extra degree of freedom.
  `private static float`
  `noise4_UnskewedBase(long seed, double xs, double ys, double zs, double ws)`
  4D OpenSimplex2 noise base.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### PRIME_X

    private static final long PRIME_X
    See Also:
      - Constant Field Values

  - ### PRIME_Y

    private static final long PRIME_Y
    See Also:
      - Constant Field Values

  - ### PRIME_Z

    private static final long PRIME_Z
    See Also:
      - Constant Field Values

  - ### PRIME_W

    private static final long PRIME_W
    See Also:
      - Constant Field Values

  - ### HASH_MULTIPLIER

    private static final long HASH_MULTIPLIER
    See Also:
      - Constant Field Values

  - ### SEED_FLIP_3D

    private static final long SEED_FLIP_3D
    See Also:
      - Constant Field Values

  - ### SEED_OFFSET_4D

    private static final long SEED_OFFSET_4D
    See Also:
      - Constant Field Values

  - ### ROOT2OVER2

    private static final double ROOT2OVER2
    See Also:
      - Constant Field Values

  - ### SKEW_2D

    private static final double SKEW_2D
    See Also:
      - Constant Field Values

  - ### UNSKEW_2D

    private static final double UNSKEW_2D
    See Also:
      - Constant Field Values

  - ### ROOT3OVER3

    private static final double ROOT3OVER3
    See Also:
      - Constant Field Values

  - ### FALLBACK_ROTATE_3D

    private static final double FALLBACK_ROTATE_3D
    See Also:
      - Constant Field Values

  - ### ROTATE_3D_ORTHOGONALIZER

    private static final double ROTATE_3D_ORTHOGONALIZER
    See Also:
      - Constant Field Values

  - ### SKEW_4D

    private static final float SKEW_4D
    See Also:
      - Constant Field Values

  - ### UNSKEW_4D

    private static final float UNSKEW_4D
    See Also:
      - Constant Field Values

  - ### LATTICE_STEP_4D

    private static final float LATTICE_STEP_4D
    See Also:
      - Constant Field Values

  - ### N_GRADS_2D_EXPONENT

    private static final int N_GRADS_2D_EXPONENT
    See Also:
      - Constant Field Values

  - ### N_GRADS_3D_EXPONENT

    private static final int N_GRADS_3D_EXPONENT
    See Also:
      - Constant Field Values

  - ### N_GRADS_4D_EXPONENT

    private static final int N_GRADS_4D_EXPONENT
    See Also:
      - Constant Field Values

  - ### N_GRADS_2D

    private static final int N_GRADS_2D
    See Also:
      - Constant Field Values

  - ### N_GRADS_3D

    private static final int N_GRADS_3D
    See Also:
      - Constant Field Values

  - ### N_GRADS_4D

    private static final int N_GRADS_4D
    See Also:
      - Constant Field Values

  - ### NORMALIZER_2D

    private static final double NORMALIZER_2D
    See Also:
      - Constant Field Values

  - ### NORMALIZER_3D

    private static final double NORMALIZER_3D
    See Also:
      - Constant Field Values

  - ### NORMALIZER_4D

    private static final double NORMALIZER_4D
    See Also:
      - Constant Field Values

  - ### RSQUARED_2D

    private static final float RSQUARED_2D
    See Also:
      - Constant Field Values

  - ### RSQUARED_3D

    private static final float RSQUARED_3D
    See Also:
      - Constant Field Values

  - ### RSQUARED_4D

    private static final float RSQUARED_4D
    See Also:
      - Constant Field Values

  - ### GRADIENTS_2D

    private static float[] GRADIENTS_2D

  - ### GRADIENTS_3D

    private static float[] GRADIENTS_3D

  - ### GRADIENTS_4D

    private static float[] GRADIENTS_4D

- ## Constructor Details

  - ### OpenSimplex2

    public OpenSimplex2()

- ## Method Details

  - ### noise2

    public static float noise2(long seed, double x, double y)
    2D Simplex noise, standard lattice orientation.

  - ### noise2_ImproveX

    public static float noise2_ImproveX(long seed, double x, double y)
    2D Simplex noise, with Y pointing down the main diagonal. Might be better for a 2D sandbox style game, where Y is vertical. Probably slightly less optimal for heightmaps or continent maps, unless your map is centered around an equator. It's a subtle difference, but the option is here to make it an easy choice.

  - ### noise2_UnskewedBase

    private static float noise2_UnskewedBase(long seed, double xs, double ys)
    2D Simplex noise base.

  - ### noise3_ImproveXY

    public static float noise3_ImproveXY(long seed, double x, double y, double z)
    3D OpenSimplex2 noise, with better visual isotropy in (X, Y). Recommended for 3D terrain and time-varied animations. The Z coordinate should always be the "different" coordinate in whatever your use case is. If Y is vertical in world coordinates, call noise3_ImproveXZ(x, z, Y) or use noise3_XZBeforeY. If Z is vertical in world coordinates, call noise3_ImproveXZ(x, y, Z). For a time varied animation, call noise3_ImproveXY(x, y, T).

  - ### noise3_ImproveXZ

    public static float noise3_ImproveXZ(long seed, double x, double y, double z)
    3D OpenSimplex2 noise, with better visual isotropy in (X, Z). Recommended for 3D terrain and time-varied animations. The Y coordinate should always be the "different" coordinate in whatever your use case is. If Y is vertical in world coordinates, call noise3_ImproveXZ(x, Y, z). If Z is vertical in world coordinates, call noise3_ImproveXZ(x, Z, y) or use noise3_ImproveXY. For a time varied animation, call noise3_ImproveXZ(x, T, y) or use noise3_ImproveXY.

  - ### noise3_Fallback

    public static float noise3_Fallback(long seed, double x, double y, double z)
    3D OpenSimplex2 noise, fallback rotation option Use noise3_ImproveXY or noise3_ImproveXZ instead, wherever appropriate. They have less diagonal bias. This function's best use is as a fallback.

  - ### noise3_UnrotatedBase

    private static float noise3_UnrotatedBase(long seed, double xr, double yr, double zr)
    Generate overlapping cubic lattices for 3D OpenSimplex2 noise.

  - ### noise4_ImproveXYZ_ImproveXY

    public static float noise4_ImproveXYZ_ImproveXY(long seed, double x, double y, double z, double w)
    4D OpenSimplex2 noise, with XYZ oriented like noise3_ImproveXY and W for an extra degree of freedom. W repeats eventually. Recommended for time-varied animations which texture a 3D object (W=time) in a space where Z is vertical

  - ### noise4_ImproveXYZ_ImproveXZ

    public static float noise4_ImproveXYZ_ImproveXZ(long seed, double x, double y, double z, double w)
    4D OpenSimplex2 noise, with XYZ oriented like noise3_ImproveXZ and W for an extra degree of freedom. W repeats eventually. Recommended for time-varied animations which texture a 3D object (W=time) in a space where Y is vertical

  - ### noise4_ImproveXYZ

    public static float noise4_ImproveXYZ(long seed, double x, double y, double z, double w)
    4D OpenSimplex2 noise, with XYZ oriented like noise3_Fallback and W for an extra degree of freedom. W repeats eventually. Recommended for time-varied animations which texture a 3D object (W=time) where there isn't a clear distinction between horizontal and vertical

  - ### noise4_ImproveXY_ImproveZW

    public static float noise4_ImproveXY_ImproveZW(long seed, double x, double y, double z, double w)
    4D OpenSimplex2 noise, with XY and ZW forming orthogonal triangular-based planes. Recommended for 3D terrain, where X and Y (or Z and W) are horizontal. Recommended for noise(x, y, sin(time), cos(time)) trick.

  - ### noise4_Fallback

    public static float noise4_Fallback(long seed, double x, double y, double z, double w)
    4D OpenSimplex2 noise, fallback lattice orientation.

  - ### noise4_UnskewedBase

    private static float noise4_UnskewedBase(long seed, double xs, double ys, double zs, double ws)
    4D OpenSimplex2 noise base.

  - ### grad

    private static float grad(long seed, long xsvp, long ysvp, float dx, float dy)

  - ### grad

    private static float grad(long seed, long xrvp, long yrvp, long zrvp, float dx, float dy, float dz)

  - ### grad

    private static float grad(long seed, long xsvp, long ysvp, long zsvp, long wsvp, float dx, float dy, float dz, float dw)

  - ### fastFloor

    private static int fastFloor(double x)

  - ### fastRound

    private static int fastRound(double x)