# Noise

## Functions

 void `Perlin2d` void `Perlin2dD` `RED_RC` `Perlin2dP` void `Perlin3d` void `Perlin3dD` `RED_RC` `Perlin3dP` void `Worley2d` void `Worley2dD` void `Worley3d` void `Worley3dD`

## Detailed Description

class Noise

Noise functions class.

This class introduces useful functions to produce 2d/3d noise.

Public Static Functions

static void Perlin2d(double &oNoise, const double iPos[2])

Computes Perlin noise at the given 2d position.

Parameters
• oNoise – returned Perlin 2d noise in [-1, 1].

• iPos – 2d position.

static void Perlin2dD(double &oNoise, double oD[2], const double iPos[2])

Computes Perlin noise at the given 2d position including derivatives.

Parameters
• oNoise – returned Perlin 2d noise in [-1, 1].

• oD – derivatives in x and y.

• iPos – 2d position.

static RED_RC Perlin2dP(double &oNoise, const double iPos[2], const int iPeriod[2])

Computes Perlin noise at the given 2d position and wraps the gradients around the given period.

Parameters
• oNoise – returned Perlin 2d noise in [-1, 1].

• iPos – 2d position.

• iPeriod – values above this threshold will be wrapped, must be greater than 0.

Returns

RED_OK on success, RED_BAD_PARAM if period is not greater than 0.

static void Perlin3d(double &oNoise, const double iPos[3])

Computes Perlin noise at the given 3d position.

Parameters
• oNoise – returned Perlin 3d noise in [-1, 1].

• iPos – 3d position.

static void Perlin3dD(double &oNoise, double oD[3], const double iPos[3])

Computes Perlin noise at the given 3d position including derivatives.

Parameters
• oNoise – returned Perlin 3d noise in [-1, 1].

• oD – derivatives in x, y and z.

• iPos – 3d position.

static RED_RC Perlin3dP(double &oNoise, const double iPos[3], const int iPeriod[3])

Computes Perlin noise at the given 3d position and wraps the gradients around the given period.

Parameters
• oNoise – returned Perlin 3d noise in [-1, 1].

• iPos – 3d position.

• iPeriod – iPos above this threshold will be wrapped, must be greater than 0.

Returns

RED_OK on success, RED_BAD_PARAM if period is not greater than 0.

static void Worley2d(double &oNoise, const double iPos[2])

Computes Worley noise at the given 2d position.

Parameters
• oNoise – returned Worley 2d noise in [-1, 1].

• iPos – 2d position.

static void Worley2dD(double &oNoise, double oD[2], const double iPos[2])

Computes Worley noise at the given 2d position including derivatives.

Parameters
• oNoise – returned Worley 2d noise in [-1, 1].

• oD – derivatives in x and y.

• iPos – 2d position.

static void Worley3d(double &oNoise, const double iPos[3])

Computes Worley noise at the given 2d position.

Parameters
• oNoise – returned Worley 3d noise in [-1, 1].

• iPos – 3d position.

static void Worley3dD(double &oNoise, double oD[3], const double iPos[3])

Computes Worley noise at the given 3d position including derivatives.

Parameters
• oNoise – returned Worley 3d noise in [-1, 1].

• oD – derivatives in x, y and z.

• iPos – 3d position.