# Noise.cpp File Reference

`#include <math.h>`
`#include <stdlib.h>`

Include dependency graph for Noise.cpp:

## Defines

#define | MAXB 0x100
#define | N 0x1000
#define | NP 12
#define | NM 0xfff
#define | s_curve(t) ( t * t * (3. - 2. * t) )
#define | lerp(t, a, b) ( a + t * (b - a) )
#define | setup(i, b0, b1, r0, r1)
#define | at2(rx, ry) ( rx * q[0] + ry * q[1] )
#define | at3(rx, ry, rz) ( rx * q[0] + ry * q[1] + rz * q[2] )

## Functions

void | SetNoiseFrequency (int frequency)
double | noise1 (double arg)
double | noise2 (double vec[2])
double | noise3 (double vec[3])
void | normalize2 (double v[2])
void | normalize3 (double v[3])
double | PerlinNoise1D (double x, double alpha, double beta, int n)
double | PerlinNoise2D (double x, double y, double alpha, double beta, int n)
double | PerlinNoise3D (double x, double y, double z, double alpha, double beta, int n)

## Variables

int | start
int | B
int | BM

## Define Documentation

#define at2 | ( | rx,
|  | ry |  | ) | ( rx * q[0] + ry * q[1] )

#define at3 | ( | rx,
|  | ry,
|  | rz |  | ) | ( rx * q[0] + ry * q[1] + rz * q[2] )

#define lerp | ( | t,
|  | a,
|  | b |  | ) | ( a + t * (b - a) )

#define MAXB 0x100

#define N 0x1000

#define NM 0xfff

#define NP 12

#define s_curve | ( | t |  | ) | ( t * t * (3. - 2. * t) )

#define setup | ( | i,
|  | b0,
|  | b1,
|  | r0,
|  | r1 |  | ) |

Value:

    t = vec[i] + N;\
            b0 = ((int)t) & BM;\
            b1 = (b0+1) & BM;\
            r0 = t - (int)t;\
            r1 = r0 - 1.;

## Function Documentation

double noise1 | ( | double | arg | ) |

double noise2 | ( | double | vec[2] | ) |

double noise3 | ( | double | vec[3] | ) |

void normalize2 | ( | double | v[2] | ) |

void normalize3 | ( | double | v[3] | ) |

double PerlinNoise1D | ( | double | x,
|  | double | alpha,
|  | double | beta,
|  | int | n
| ) |

double PerlinNoise2D | ( | double | x,
|  | double | y,
|  | double | alpha,
|  | double | beta,
|  | int | n
| ) |

double PerlinNoise3D | ( | double | x,
|  | double | y,
|  | double | z,
|  | double | alpha,
|  | double | beta,
|  | int | n
| ) |

void SetNoiseFrequency | ( | int | frequency | ) |

## Variable Documentation

int B

int BM

int start