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
     
    private static float[]
     
    private static float[]
     
    private static float[]
     
    private static final long
     
    private static final float
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final int
     
    private static final double
     
    private static final double
     
    private static final double
     
    private static final long
     
    private static final long
     
    private static final long
     
    private static final long
     
    private static final double
     
    private static final double
     
    private static final double
     
    private static final float
     
    private static final float
     
    private static final float
     
    private static final long
     
    private static final long
     
    private static final double
     
    private static final float
     
    private static final double
     
    private static final float
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • 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

  • 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)