# Noise

Used to generate different kinds of noise fields.

The Noise `class` contains functions to get the value at a certain point of different noise fields. The coordinates can be one-, two-, three- or four-dimensional, and are specified by the parameters a, b, c and d. For the lesser dimensions, the parameters that aren't used can be omitted. The noise fields don't need much memory so don't worry about the dimension. The period of the noise fields is 1024.

Important: Before you use the `Fbm()` or `RidgedMultifractal()` functions you need to call the `InitFbm()` function once.

For more information on how the different noise fields work, see the book Texturing and Modelling : A Procedural Approach, Ebert et al., AP Professional, ISBN 0-12-228760-6.

## Definition

``````class Noise
{
public:
Noise();

//Between 0 and 1
float Noise(float a, float b  =  0, float c  =  0, float d  =  0);

//Between -1 and 1
float SNoise(float a, float b  =  0, float c  =  0, float d  =  0);

//Between -2 and 2
float Turbulence(float octaves, bool abs, float a  =  0, float b  =  0, float c  =  0, float d  =  0);

//Called once before Fbm and RMf
void InitFbm(float lacunarity, float h);

//Between -2 and 2
float Fbm(float octaves, float a, float b =  0, float c =  0, float d =  0);

//Between -2 and 2
float RigdedMultifractal(float octaves, float offset, float gain, float a, float b  =  0, float c  =  0, float d  =  0);
};
``````

## Members

#### Noise()

Class Constructor

#### float Noise(float a, float b = 0, float c = 0, float d = 0)

Returns the value at the point `[a, b, c, d]` in a standard noise field. The higher dimension parameters are optional. Omitted coordinates are treated as 0.

##### Return
float

The return value is between 0 and 1.

#### float SNoise(float a, float b = 0, float c = 0, float d = 0)

Returns the value at the point `[a, b, c, d]` in a standard noise field. The higher dimension parameters are optional. Omitted coordinates are treated as 0.

##### Return
float

The return value is between -1 and 1.

#### float Turbulence(float octaves, bool abs, float a = 0, float b = 0, float c = 0, float d = 0)

Returns the value at the point `[a, b, c, d]` in a turbulence field. The higher dimension parameters are optional. Omitted coordinates are treated as 0.

##### Return
float

The return value is between -2 and 2 if `abs` is `FALSE` or between 0 and 2 if `abs` is `TRUE`.

##### Parameters
float octaves

The more octaves, the more details you will get.
However, the octaves are limited to 20.

bool abs

Set to `TRUE` if you want absolute values.

#### void InitFbm(float lacunarity, float h)

Must be called once before `Fbm()` or `RidgedMultifractal()` is called.

#### float Fbm(float octaves, float a, float b = 0, float c = 0, float d = 0)

Returns the value at the point `[a, b, c, d]` in a fractal Brownian motion field. The higher dimension parameters are optional. Omitted coordinates are treated as 0.

##### Return
float

The return value is between -2 and 2.

##### Parameters
float octaves

The more octaves, the more details you will get.
However, the octaves are limited to 20.

#### float RigdedMultifractal(float octaves, float offset, float gain, float a, float b = 0, float c = 0, float d = 0)

Returns the value at the point `[a, b, c, d]` in a ridged multifractal field. The higher dimension parameters are optional. Omitted coordinates are treated as 0.

##### Return
float

The return value is between -2 and 2.

##### Parameters
float octaves

The more octaves, the more details you will get.
However, the octaves are limited to 20.