2D Amortized Noise Performance Evaluator
A Program to Evaluate the Performance of Amortized Noise
 All Classes Files Functions Variables Macros Pages
Functions
perlin.cpp File Reference

Code file for 2D Perlin noise functions. More...

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "Common.h"

Functions

float noise2 (float vec[2])
 
void normalize2 (float v[2])
 
void swap (int &x, int &y)
 
void initPerlin2D ()
 Initialize Perlin's permutation and gradient tables.
 
float PerlinNoise2D (float x, float y, float alpha, float beta, int n)
 Generate a cell of 2D Perlin noise.
 

Function Documentation

void initPerlin2D ( )

Initialize gradient and permutation tables.

float noise2 ( float  vec[2])

Compute a single octave at 2D noise at a single point.

Parameters
vecPoint at which to evaluate noise.
Returns
Noise value between -1.0 and 1.0.
void normalize2 ( float  v[2])

2D vector normalize. Works by side-effect.

Parameters
v2D vector.
float PerlinNoise2D ( float  x,
float  y,
float  alpha,
float  beta,
int  n 
)

Compute turbulence, also known as 1/f noise.

Parameters
xX coordinate.
yY coordinate.
alphaPersistence.
betaLacunarity.
nSide of square grid.
Returns
Scale factor required to bring it down to range [-1, 1].
void swap ( int &  x,
int &  y 
)

Swap two values.

Parameters
xFirst value.
ySecond value.