Ocular Engine
Ocular::Math::Noise::PerlinNoise Class Reference

#include <PerlinNoise.hpp>

Inheritance diagram for Ocular::Math::Noise::PerlinNoise:
Ocular::Math::Noise::ANoise

Public Member Functions

virtual float getValue (float const x)
 
virtual float getValue (float const x, float const y)
 
virtual float getValue (float const x, float const y, float const z)
 
void setOctaves (uint32_t const octaves)
 
void setPersistence (float const persistence)
 
void setScale (float const scale)
 
void seed (int64_t seed)
 

Protected Member Functions

float getInterpolatedNoise (float const x)
 
float getInterpolatedNoise (float const x, float const y)
 
float getInterpolatedNoise (float const x, float const y, float const z)
 
float getSmoothNoise (float const x, float const y)
 
float getRandom (float const x, float const y)
 

Detailed Description

Perlin Noise is a type of gradient noise. It was designed in 1983 by Ken Perlin, and is very similar to Simplex Noise.

Compared to Simplex Noise, Perlin Noise is more computationally expensive and suffers from directional artifacts. Perlin Noise also has the behaviour that values on integer coordinates will always be equal to 0.

Member Function Documentation

float Ocular::Math::Noise::PerlinNoise::getValue ( float const  x)
virtual

Returns the noise value at the specified point.

Note: To get the raw noise value (without octaves, etc.) set the octaves, scale, and persistence all to 1.

Parameters
[in]x
Returns
Value on range [-1.0, 1.0]

Reimplemented from Ocular::Math::Noise::ANoise.

float Ocular::Math::Noise::PerlinNoise::getValue ( float const  x,
float const  y 
)
virtual

Returns the noise value at the specified 2D coordinates.

Note: To get the raw noise value (without octaves, etc.) set the octaves, scale, and persistence all to 1.

Parameters
[in]x
[in]y
Returns
Value on range [-1.0, 1.0]

Reimplemented from Ocular::Math::Noise::ANoise.

float Ocular::Math::Noise::PerlinNoise::getValue ( float const  x,
float const  y,
float const  z 
)
virtual

Returns the noise value at the specified 3D coordinates.

Note: To get the raw noise value (without octaves, etc.) set the octaves, scale, and persistence all to 1.

Parameters
[in]x
[in]y
[in]z
Returns
Value on range [0.0, 1.0]

Reimplemented from Ocular::Math::Noise::ANoise.

void Ocular::Math::Noise::PerlinNoise::seed ( int64_t  seed)

Reseeds the lookup tables used to generate noise values.

Parameters
[in]seed
void Ocular::Math::Noise::PerlinNoise::setOctaves ( uint32_t const  octaves)

Sets the number of octaves to apply when generating noise values.

For each octave, a higher frequency/lower amplitude function will be added to the original. Additional octaves increase the amount of time required to generate the final value, but increases the definition.

Parameters
octavesNumber of octaves to apply (sane values are 0 to 15) (default 6)
void Ocular::Math::Noise::PerlinNoise::setPersistence ( float const  persistence)

Sets the persistence value for applied octaves.

The higher the persistence, the more of each succeeding octave will be added to the original. Very high persistence values can lead to output the resembles raw noise.

Parameters
[in]persistencePersistence value 0.0, 1.0
void Ocular::Math::Noise::PerlinNoise::setScale ( float const  scale)

Sets the scale of the noise generator.

Scale can be thought of as a zoom-level. The lower the scale, the closer in the zoom and vice versa.

Extremely low values can result in a blobby or solid output. Extremely high values can result in output that resembles raw noise.

Parameters
[in]scaleScale value (sane values are 0.0001 to 1.0) (default 0.01)

The documentation for this class was generated from the following files: