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

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

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

Functions

unsigned int h2 (unsigned int x, unsigned int y)
 
float infinitenoise2 (float vec[2])
 
float InfinitePerlinNoise2D (float x, float y, float alpha, float beta, int n)
 Generate a cell of 2D infinite Perlin noise.
 

Detailed Description

Infinite Perlin noise uses MurmurHash3 to get the gradients at integer points.

Function Documentation

unsigned int h2 ( unsigned int  x,
unsigned int  y 
)

A 2D hash function. Hash two dimensions into a single unsigned int using MurmurHash.

Parameters
xX coordinate of value to be hashed.
yY coordinate of value to be hashed.
Returns
Hash of (x, y).
float infinitenoise2 ( float  vec[2])

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

Parameters
vecPoint at which to evaluate noise.
Returns
Noise value between -1.0 and 1.0.
float InfinitePerlinNoise2D ( 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].