Catlike Coding
Unity Code Documentation
Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
CatlikeCoding.Noise.NoiseMath Class Reference

Utility class that contains mathematical operations, constants, and arrays used by noise classes. More...

Static Public Member Functions

static float Dot (Vector2 g, float x, float y)
 Dot product of two 2D vectors. More...
 
static float Dot (Vector3 g, float x, float y, float z)
 Dot product of two 3D vectors. More...
 
static int FloorToInt (float value)
 Fast float to floored int conversion. More...
 
static float Smooth (float t)
 Smoothing of interpolator. More...
 

Public Attributes

const int gradientsMask2D = 15
 Mask for indexing the 2D gradient array. More...
 
const int gradientsMask3D = 15
 Mask for indexing the 3D gradient array. More...
 
const int hashMask = 255
 Mask for indexing the hash array. More...
 

Static Public Attributes

static Vector2[] gradients2D
 2D gradient vector array. More...
 
static Vector3[] gradients3D
 3D gradient vector array. More...
 
static int[] hash
 Permutation array used to find hash values. More...
 

Detailed Description

Utility class that contains mathematical operations, constants, and arrays used by noise classes.

Member Function Documentation

static float CatlikeCoding.Noise.NoiseMath.Dot ( Vector2  g,
float  x,
float  y 
)
static

Dot product of two 2D vectors.

Parameters
gThe first vector.
xThe x coordinate of the second vector.
yThe y coordinate of the second vector.
static float CatlikeCoding.Noise.NoiseMath.Dot ( Vector3  g,
float  x,
float  y,
float  z 
)
static

Dot product of two 3D vectors.

Parameters
gThe first vector.
xThe x coordinate of the second vector.
yThe y coordinate of the second vector.
zThe z coordinate of the second vector.
static int CatlikeCoding.Noise.NoiseMath.FloorToInt ( float  value)
static

Fast float to floored int conversion.

Parameters
valueValue.
static float CatlikeCoding.Noise.NoiseMath.Smooth ( float  t)
static

Smoothing of interpolator.

Parameters
tInterpolation value.

Member Data Documentation

Vector2 [] CatlikeCoding.Noise.NoiseMath.gradients2D
static
Initial value:
= {
new Vector2( 1f, 0f),
new Vector2(-1f, 0f),
new Vector2( 0f, 1f),
new Vector2( 0f,-1f),
new Vector2(0.707106781f, 0.707106781f),
new Vector2(-0.707106781f, 0.707106781f),
new Vector2(0.707106781f, -0.707106781f),
new Vector2(-0.707106781f, -0.707106781f),
new Vector2(0.3826835f, 0.9238795f),
new Vector2(-0.3826835f, 0.9238795f),
new Vector2(0.3826835f, -0.9238795f),
new Vector2(-0.3826835f, -0.9238795f),
new Vector2(0.9238795f, 0.3826835f),
new Vector2(-0.9238795f, 0.3826835f),
new Vector2(-0.9238795f, -0.3826835f),
new Vector2(0.9238795f, -0.3826835f)
}

2D gradient vector array.

Vector3 [] CatlikeCoding.Noise.NoiseMath.gradients3D
static
Initial value:
= {
new Vector3( 1f, 1f, 0f),
new Vector3(-1f, 1f, 0f),
new Vector3( 1f,-1f, 0f),
new Vector3(-1f,-1f, 0f),
new Vector3( 1f, 0f, 1f),
new Vector3(-1f, 0f, 1f),
new Vector3( 1f, 0f,-1f),
new Vector3(-1f, 0f,-1f),
new Vector3( 0f, 1f, 1f),
new Vector3( 0f,-1f, 1f),
new Vector3( 0f, 1f,-1f),
new Vector3( 0f,-1f,-1f),
new Vector3( 1f, 1f, 0f),
new Vector3(-1f, 1f, 0f),
new Vector3( 0f,-1f, 1f),
new Vector3( 0f,-1f,-1f)
}

3D gradient vector array.

const int CatlikeCoding.Noise.NoiseMath.gradientsMask2D = 15

Mask for indexing the 2D gradient array.

const int CatlikeCoding.Noise.NoiseMath.gradientsMask3D = 15

Mask for indexing the 3D gradient array.

int [] CatlikeCoding.Noise.NoiseMath.hash
static

Permutation array used to find hash values.

const int CatlikeCoding.Noise.NoiseMath.hashMask = 255

Mask for indexing the hash array.