CS::Math::Noise::Module::RidgedMulti Class Reference (Crystal Space 2.0 Public API Reference)

| ## Public API Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes
CS::Math::Noise::Module::RidgedMulti Class Reference
Generator Modules

Noise module that outputs 3-dimensional ridged-multifractal noise. More...

`#include <cstool/noise/module/ridgedmulti.h>`

Inheritance diagram for CS::Math::Noise::Module::RidgedMulti:

List of all members.

## Public Member Functions
double | GetFrequency () const
| Returns the frequency of the first octave.
double | GetLacunarity () const
| Returns the lacunarity of the ridged-multifractal noise.
CS::Math::Noise::NoiseQuality | GetNoiseQuality () const
| Returns the quality of the ridged-multifractal noise.
int | GetOctaveCount () const
| Returns the number of octaves that generate the ridged-multifractal noise.
int | GetSeed () const
| Returns the seed value used by the ridged-multifractal-noise function.
virtual int | GetSourceModuleCount () const
| Returns the number of source modules required by this noise module.
virtual double | GetValue (double x, double y, double z) const
| Generates an output value given the coordinates of the specified input value.
| RidgedMulti ()
| Constructor.
void | SetFrequency (double frequency)
| Sets the frequency of the first octave.
void | SetLacunarity (double lacunarity)
| Sets the lacunarity of the ridged-multifractal noise.
void | SetNoiseQuality (CS::Math::Noise::NoiseQuality noiseQuality)
| Sets the quality of the ridged-multifractal noise.
void | SetOctaveCount (int octaveCount)
| Sets the number of octaves that generate the ridged-multifractal noise.
void | SetSeed (int seed)
| Sets the seed value used by the ridged-multifractal-noise function.
## Protected Member Functions
void | CalcSpectralWeights ()
| Calculates the spectral weights for each octave.
## Protected Attributes
double | m_frequency
| Frequency of the first octave.
double | m_lacunarity
| Frequency multiplier between successive octaves.
CS::Math::Noise::NoiseQuality | m_noiseQuality
| Quality of the ridged-multifractal noise.
int | m_octaveCount
| Total number of octaves that generate the ridged-multifractal noise.
double | m_pSpectralWeights [RIDGED_MAX_OCTAVE]
| Contains the spectral weights for each octave.
int | m_seed
| Seed value used by the ridged-multfractal-noise function.

## Detailed Description

Noise module that outputs 3-dimensional ridged-multifractal noise.

This noise module, heavily based on the Perlin-noise module, generates ridged-multifractal noise. Ridged-multifractal noise is generated in much of the same way as Perlin noise, except the output of each octave is modified by an absolute-value function. Modifying the octave values in this way produces ridge-like formations.

Ridged-multifractal noise does not use a persistence value. This is because the persistence values of the octaves are based on the values generated from from previous octaves, creating a feedback loop (or that's what it looks like after reading the code.)

This noise module outputs ridged-multifractal-noise values that usually range from -1.0 to +1.0, but there are no guarantees that all output values will exist within that range.

Note:
  For ridged-multifractal noise generated with only one octave, the output value ranges from -1.0 to 0.0.

Ridged-multifractal noise is often used to generate craggy mountainous terrain or marble-like textures.

This noise module does not require any source modules.

Octaves

The number of octaves control the amount of detail of the ridged-multifractal noise. Adding more octaves increases the detail of the ridged-multifractal noise, but with the drawback of increasing the calculation time.

An application may specify the number of octaves that generate ridged-multifractal noise by calling the SetOctaveCount() method.

Frequency

An application may specify the frequency of the first octave by calling the SetFrequency() method.

Lacunarity

The lacunarity specifies the frequency multipler between successive octaves.

The effect of modifying the lacunarity is subtle; you may need to play with the lacunarity value to determine the effects. For best results, set the lacunarity to a number between 1.5 and 3.5.

References & Acknowledgments

F. Kenton "Doc Mojo" Musgrave's texturing page - This page contains links to source code that generates ridged-multfractal noise, among other types of noise. The source file fractal.c contains the code I used in my ridged-multifractal class (see the RidgedMultifractal() function.) This code was written by F. Kenton Musgrave, the person who created MojoWorld. He is also one of the authors in Texturing and Modeling: A Procedural Approach (Morgan Kaufmann, 2002. ISBN 1-55860-848-6.)

Definition at line 127 of file ridgedmulti.h.

## Constructor & Destructor Documentation

CS::Math::Noise::Module::RidgedMulti::RidgedMulti | ( |  | ) |

Constructor.

The default number of octaves is set to CS::Math::Noise::Module::DEFAULT_RIDGED_OCTAVE_COUNT.

The default frequency is set to CS::Math::Noise::Module::DEFAULT_RIDGED_FREQUENCY.

The default lacunarity is set to CS::Math::Noise::Module::DEFAULT_RIDGED_LACUNARITY.

The default seed value is set to CS::Math::Noise::Module::DEFAULT_RIDGED_SEED.

## Member Function Documentation

void CS::Math::Noise::Module::RidgedMulti::CalcSpectralWeights | ( |  | ) | `[protected]`

Calculates the spectral weights for each octave.

This method is called when the lacunarity changes.

double CS::Math::Noise::Module::RidgedMulti::GetFrequency | ( |  | ) | const`[inline]`

Returns the frequency of the first octave.

Returns:
  The frequency of the first octave.

Definition at line 150 of file ridgedmulti.h.

double CS::Math::Noise::Module::RidgedMulti::GetLacunarity | ( |  | ) | const`[inline]`

Returns the lacunarity of the ridged-multifractal noise.

Returns:
  The lacunarity of the ridged-multifractal noise.

The lacunarity is the frequency multiplier between successive octaves.

Definition at line 161 of file ridgedmulti.h.

CS::Math::Noise::NoiseQuality CS::Math::Noise::Module::RidgedMulti::GetNoiseQuality | ( |  | ) | const`[inline]`

Returns the quality of the ridged-multifractal noise.

Returns:
  The quality of the ridged-multifractal noise.

See CS::Math::Noise::NoiseQuality for definitions of the various coherent-noise qualities.

Definition at line 172 of file ridgedmulti.h.

int CS::Math::Noise::Module::RidgedMulti::GetOctaveCount | ( |  | ) | const`[inline]`

Returns the number of octaves that generate the ridged-multifractal noise.

Returns:
  The number of octaves that generate the ridged-multifractal noise.

The number of octaves controls the amount of detail in the ridged-multifractal noise.

Definition at line 185 of file ridgedmulti.h.

int CS::Math::Noise::Module::RidgedMulti::GetSeed | ( |  | ) | const`[inline]`

Returns the seed value used by the ridged-multifractal-noise function.

Returns:
  The seed value.

Definition at line 194 of file ridgedmulti.h.

virtual int CS::Math::Noise::Module::RidgedMulti::GetSourceModuleCount | ( |  | ) | const`[inline, virtual]`

Returns the number of source modules required by this noise module.

Returns:
  The number of source modules required by this noise module.

Implements CS::Math::Noise::Module::Module.

Definition at line 199 of file ridgedmulti.h.

virtual double CS::Math::Noise::Module::RidgedMulti::GetValue | ( | double | x,
|  | double | y,
|  | double | z
| ) |  | const`[virtual]`

Generates an output value given the coordinates of the specified input value.

Parameters:

  x | The x coordinate of the input value.
  y | The y coordinate of the input value.
  z | The z coordinate of the input value.

Returns:
  The output value.

Precondition:
  All source modules required by this noise module have been passed to the SetSourceModule() method.

Before an application can call this method, it must first connect all required source modules via the SetSourceModule() method. If these source modules are not connected to this noise module, this method raises a debug assertion.

To determine the number of source modules required by this noise module, call the GetSourceModuleCount() method.

Implements CS::Math::Noise::Module::Module.

void CS::Math::Noise::Module::RidgedMulti::SetFrequency | ( | double | frequency | ) | `[inline]`

Sets the frequency of the first octave.

Parameters:

  frequency | The frequency of the first octave.

Definition at line 209 of file ridgedmulti.h.

void CS::Math::Noise::Module::RidgedMulti::SetLacunarity | ( | double | lacunarity | ) | `[inline]`

Sets the lacunarity of the ridged-multifractal noise.

Parameters:

  lacunarity | The lacunarity of the ridged-multifractal noise.

The lacunarity is the frequency multiplier between successive octaves.

For best results, set the lacunarity to a number between 1.5 and 3.5.

Definition at line 223 of file ridgedmulti.h.

void CS::Math::Noise::Module::RidgedMulti::SetNoiseQuality | ( | CS::Math::Noise::NoiseQuality | noiseQuality | ) | `[inline]`

Sets the quality of the ridged-multifractal noise.

Parameters:

  noiseQuality | The quality of the ridged-multifractal noise.

See CS::Math::Noise::NoiseQuality for definitions of the various coherent-noise qualities.

Definition at line 235 of file ridgedmulti.h.

void CS::Math::Noise::Module::RidgedMulti::SetOctaveCount | ( | int | octaveCount | ) | `[inline]`

Sets the number of octaves that generate the ridged-multifractal noise.

Parameters:

  octaveCount | The number of octaves that generate the ridged-multifractal noise.

Precondition:
  The number of octaves ranges from 1 to CS::Math::Noise::Module::RIDGED_MAX_OCTAVE.

Exceptions:

  CS::Math::Noise::ExceptionInvalidParam | An invalid parameter was specified; see the preconditions for more information.

The number of octaves controls the amount of detail in the ridged-multifractal noise.

The larger the number of octaves, the more time required to calculate the ridged-multifractal-noise value.

Definition at line 257 of file ridgedmulti.h.

void CS::Math::Noise::Module::RidgedMulti::SetSeed | ( | int | seed | ) | `[inline]`

Sets the seed value used by the ridged-multifractal-noise function.

Parameters:

  seed | The seed value.

Definition at line 270 of file ridgedmulti.h.

## Member Data Documentation

double CS::Math::Noise::Module::RidgedMulti::m_frequency`[protected]`

Frequency of the first octave.

Definition at line 283 of file ridgedmulti.h.

double CS::Math::Noise::Module::RidgedMulti::m_lacunarity`[protected]`

Frequency multiplier between successive octaves.

Definition at line 286 of file ridgedmulti.h.

CS::Math::Noise::NoiseQuality CS::Math::Noise::Module::RidgedMulti::m_noiseQuality`[protected]`

Quality of the ridged-multifractal noise.

Definition at line 289 of file ridgedmulti.h.

int CS::Math::Noise::Module::RidgedMulti::m_octaveCount`[protected]`

Total number of octaves that generate the ridged-multifractal noise.

Definition at line 293 of file ridgedmulti.h.

double CS::Math::Noise::Module::RidgedMulti::m_pSpectralWeights[RIDGED_MAX_OCTAVE]`[protected]`

Contains the spectral weights for each octave.

Definition at line 296 of file ridgedmulti.h.

int CS::Math::Noise::Module::RidgedMulti::m_seed`[protected]`

Seed value used by the ridged-multfractal-noise function.

Definition at line 299 of file ridgedmulti.h.

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

- cstool/noise/module/ridgedmulti.h