CS::Math::Noise::Module::Spheres 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 Attributes
CS::Math::Noise::Module::Spheres Class Reference
Generator Modules

Noise module that outputs concentric spheres. More...

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

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

List of all members.

## Public Member Functions
double | GetFrequency () const
| Returns the frequency of the concentric spheres.
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.
void | SetFrequency (double frequency)
| Sets the frequenct of the concentric spheres.
| Spheres ()
| Constructor.
## Protected Attributes
double | m_frequency
| Frequency of the concentric spheres.

## Detailed Description

Noise module that outputs concentric spheres.

This noise module outputs concentric spheres centered on the origin like the concentric rings of an onion.

The first sphere has a radius of 1.0. Each subsequent sphere has a radius that is 1.0 unit larger than the previous sphere.

The output value from this noise module is determined by the distance between the input value and the the nearest spherical surface. The input values that are located on a spherical surface are given the output value 1.0 and the input values that are equidistant from two spherical surfaces are given the output value -1.0.

An application can change the frequency of the concentric spheres. Increasing the frequency reduces the distances between spheres. To specify the frequency, call the SetFrequency() method.

This noise module, modified with some low-frequency, low-power turbulence, is useful for generating agate-like textures.

This noise module does not require any source modules.

Definition at line 69 of file spheres.h.

## Constructor & Destructor Documentation

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

Constructor.

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

## Member Function Documentation

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

Returns the frequency of the concentric spheres.

Returns:
  The frequency of the concentric spheres.

Increasing the frequency increases the density of the concentric spheres, reducing the distances between them.

Definition at line 86 of file spheres.h.

virtual int CS::Math::Noise::Module::Spheres::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 91 of file spheres.h.

virtual double CS::Math::Noise::Module::Spheres::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::Spheres::SetFrequency | ( | double | frequency | ) | `[inline]`

Sets the frequenct of the concentric spheres.

Parameters:

  frequency | The frequency of the concentric spheres.

Increasing the frequency increases the density of the concentric spheres, reducing the distances between them.

Definition at line 104 of file spheres.h.

## Member Data Documentation

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

Frequency of the concentric spheres.

Definition at line 112 of file spheres.h.

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

- cstool/noise/module/spheres.h