chombo-discharge
|
Class that implements the improved Perlin noise function. More...
#include <CD_PerlinSdf.H>
Public Member Functions | |
PerlinSdf (const Real a_noiseAmp, const RealVect a_noiseFreq, const Real a_persistence, const int a_octaves, const bool a_reseed=false) | |
Full constructor. More... | |
PerlinSdf (const PerlinSdf &a_inputIF) | |
Copy constructor. More... | |
virtual | ~PerlinSdf () |
Destructor. | |
virtual Real | value (const RealVect &a_pos) const |
Level-set function. More... | |
virtual BaseIF * | newImplicitFunction () const |
Factory method. | |
Static Public Member Functions | |
static int | random (const int i) |
Simple random number generator. More... | |
Protected Member Functions | |
virtual void | reseed () |
Reseed function. | |
double | noise (const double a_x, const double a_y, const double a_z) const |
Ken Perlin's 3D noise function. More... | |
Real | noise (const RealVect &a_pos) const |
Chombo interface to Perlin noise function. | |
Real | octaveNoise (const RealVect &a_pos) const |
Octave noise function. Returns noise over over several octaves. More... | |
Real | lerp (const Real t, const Real a, const Real b) const |
Interpolation function. | |
Real | fade (const Real t) const |
Fade function. | |
Real | grad (const int hash, const double x, const double y, const double z) const |
Gradient function using hash table lookup. | |
Protected Attributes | |
RealVect | m_noiseFreq |
Perlin noise frequency. | |
Real | m_noiseAmp |
Perlin noise amplitude. | |
Real | m_persistence |
Perlin octave fade factor. | |
int | m_octaves |
Number of octaves to use for noise. | |
double | p [512] |
Permutation table. | |
Static Protected Attributes | |
constexpr static int | m_permutationTable [256] |
Ken Perlin's original permutation array. More... | |
Class that implements the improved Perlin noise function.
Typically, you will use this function to displace a level-set function by using SumIF. However, Perlin noise is also a signed distance function, and so it can be used as an implicit function as well.
PerlinSdf::PerlinSdf | ( | const Real | a_noiseAmp, |
const RealVect | a_noiseFreq, | ||
const Real | a_persistence, | ||
const int | a_octaves, | ||
const bool | a_reseed = false |
||
) |
Full constructor.
[in] | a_noiseAmp | Noise amplitude |
[in] | a_noiseFreq | Base frequency |
[in] | a_octaves | Number of octaves to use for Perlin noise |
[in] | a_persistence | Reduction factor for each octave |
[in] | a_reseed | Reseed permutation vector (true) or use Ken Perlin's original one (false) |
PerlinSdf::PerlinSdf | ( | const PerlinSdf & | a_inputIF | ) |
Copy constructor.
[in] | a_inputIF | Input PerlinSdf |
|
protected |
Ken Perlin's 3D noise function.
For 2D, we use Ken Perlin's function with z = 0
[in] | a_x | Position |
[in] | a_y | Position |
[in] | a_z | Position |
|
protected |
Octave noise function. Returns noise over over several octaves.
normFrac;
|
static |
Simple random number generator.
[in] | seed |
|
virtual |
Level-set function.
[in] | a_pos | Position |
|
staticconstexprprotected |
Ken Perlin's original permutation array.