Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

PerlinNoise Class Reference

#include <perlin.h>

List of all members.


Detailed Description

Perlin Noise generation class.

Perlin Noise generation class. Class contains functions to generate 1D, 2D and 3D perlin noise.

Author:
Rob Wanders (forteq@softhome.net)


Public Member Functions

 PerlinNoise ()
 ~PerlinNoise ()
void NewPrimeNumbers ()
bool IsPrime (unsigned int uiA)
unsigned int RandomPrime ()
float Noise (int iX)
float Noise (int iX, int iY)
float Noise (int iX, int iY, int iZ)
float Interpolate (float fA, float fB, float fX)
float SmoothNoise (int iX)
float SmoothNoise (int iX, int iY)
float SmoothNoise (int iX, int iY, int iZ)
float InterpolateNoise (float fX)
float InterpolateNoise (float fX, float fY)
float InterpolateNoise (float fX, float fY, float fZ)
float PerlinNoise1d (float fX, float fAmplitude, float fXfrequency)
float PerlinNoise2d (float fX, float fY, float fAmplitude, float fXFrequency, float fYFrequency)
float PerlinNoise3d (float fX, float fY, float fZ, float fAmplitude, float fXfrequency, float fYfrequency, float fZfrequency)
void GenerateLookup (unsigned int uiMaxX)
void GenerateLookup (unsigned int uiMaxX, unsigned int uiMaxY)
void GenerateLookup (unsigned int uiMaxX, unsigned int uiMaxY, unsigned int uiMaxZ)

Protected Attributes

unsigned int m_uiPrimeOne
unsigned int m_uiPrimeTwo
unsigned int m_uiPrimeThree
float * m_afLookUp
unsigned int m_uiMaxX
unsigned int m_uiMaxY
unsigned int m_uiMaxZ


Constructor & Destructor Documentation

PerlinNoise  ) 
 

Set standard prime numbers

~PerlinNoise  ) 
 

Free Lookup table


Member Function Documentation

void NewPrimeNumbers  ) 
 

Sets new (random) prime numbers

bool IsPrime unsigned int  uiA  ) 
 

Function checks if the given value is a prime number.

Parameters:
uiA number
Returns:
returns true if the number is a prime, false when it's not.

unsigned int RandomPrime  ) 
 

Prime number generator. Prime numbers are used by the pseudo-random number generator. If you use different primes each time you generate a texture, you'll get unique textures. Which comes in handy if you want to create natural-looking textures.

Returns:
a random prime number

float Noise int  iX  ) 
 

1d Pseude-random number generator. Generates a pseudo-random number based upon one value(dimension).

Parameters:
iX x value
Returns:
Returns a number between -1,1

float Noise int  iX,
int  iY
 

2d Pseudo-random number generator. Generates a pseudo-random number based upon two values(dimensions).

Parameters:
iX x value
iY y value
Returns:
Returns a number between -1,1

float Noise int  iX,
int  iY,
int  iZ
 

3d Pseudo-random number generator. Generates a pseudo-random number based upon three values(dimensions).

Parameters:
iX x value
iY y value
iZ z value
Returns:
Returns a number between -1,1

float Interpolate float  fA,
float  fB,
float  fX
 

Standard cosine interpolate function. Interpolates between two points. It interpolates between two points, using the third input.

Parameters:
fA first point
fB second point
fX point between the first two point.
Returns:
Interpolated value. When fX is 0, fA is returned. When fX is 1, fB is returned. And when dX is a value between 0 and 1, a value between fA and fB is returned.

float SmoothNoise int  iX  ) 
 

1d Smooth function. Function takes the average of the neighbours to make the noise look less sharp.

Parameters:
iX x value
Returns:
smooth 1d noise value

float SmoothNoise int  iX,
int  iY
 

2d Smooth function. Function takes the average of the neigbours (sides,corners,center) to make it look less sharp.

Parameters:
iX x value
iY y value
Returns:
smooth 2d noise value

float SmoothNoise int  iX,
int  iY,
int  iZ
 

3d Smooth function. Functions takes the average of the neighbours to make it look less sharp.

Parameters:
iX x value
iY y value
iZ z value
Returns:
smooth 3d noise value

float InterpolateNoise float  fX  ) 
 

1d Interpolate function. Function interpolates between the smoothed noise values.

Parameters:
fX x value
Returns:
smooth interpolated 1d noise value

float InterpolateNoise float  fX,
float  fY
 

2d Interpolate function. Function interpolates between the smoothed 2d noise values.

Parameters:
fX x value
fY y value
Returns:
smooth interpolated 2d noise value

float InterpolateNoise float  fX,
float  fY,
float  fZ
 

3d Interpolate function. Function interpolates between the smoothed 3d noise values.

Parameters:
fX x value
fY y value
fZ z value
Returns:
smooth interpolated 3d noise value

float PerlinNoise1d float  fX,
float  fAmplitude,
float  fXfrequency
 

1d Perlin Noise function. Generates perlin noise, using the given amplitude and frequency.

Parameters:
fX x value
fAmplitude amplitude
fXfrequency x frequency
Returns:
1d noise

float PerlinNoise2d float  fX,
float  fY,
float  fAmplitude,
float  fXFrequency,
float  fYFrequency
 

2d Perlin Noise function. Generates perlin noise, using the given amplitude and frequency.

Parameters:
fX x value
fY y value
fAmplitude amplitude
fXFrequency x frequency
fYFrequency y frequency
Returns:
2d noise

float PerlinNoise3d float  fX,
float  fY,
float  fZ,
float  fAmplitude,
float  fXfrequency,
float  fYfrequency,
float  fZfrequency
 

3d Perlin Noise function. Generates perlin noise, using the given amplitude and frequency.

Parameters:
fX x value
fY y value
fZ z value
fAmplitude amplitude
fXfrequency x frequency
fYfrequency y frequency
fZfrequency z frequency
Returns:
3d noise

void GenerateLookup unsigned int  uiMaxX  ) 
 

Generates the 1d noise and stores it in the lookup table (for faster processing).

Parameters:
uiMaxX max x value (generates noise from 0 to uiMaxX)

void GenerateLookup unsigned int  uiMaxX,
unsigned int  uiMaxY
 

Generates the 2d noise and stores it in the lookup table (for faster processing).

Parameters:
uiMaxX max x value (generates noise from 0 to uiMaxX)
uiMaxY max y value (generates noise from 0 to uiMaxY)

void GenerateLookup unsigned int  uiMaxX,
unsigned int  uiMaxY,
unsigned int  uiMaxZ
 

Generates the 3d noise and stores it in the lookup table (for faster processing).

Parameters:
uiMaxX max x value (generates noise from 0 to uiMaxX)
uiMaxY max y value (generates noise from 0 to uiMaxY)
uiMaxZ max z value (generates noise from 0 to uiMaxZ)


Member Data Documentation

unsigned int m_uiPrimeOne [protected]
 

Prime number one

unsigned int m_uiPrimeTwo [protected]
 

Prime number two

unsigned int m_uiPrimeThree [protected]
 

Prime number three

float* m_afLookUp [protected]
 

Lookup table

unsigned int m_uiMaxX [protected]
 

Maximum x value (for lookup table)

unsigned int m_uiMaxY [protected]
 

Maximum y value (for lookup table)

unsigned int m_uiMaxZ [protected]
 

Maximum z value (for lookup table)


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:13 2004 for NeoEngine by doxygen 1.3.5