noise::module::Voronoi Class Reference
[Generator Modules]
#include <voronoi.h>
Inheritance diagram for noise::module::Voronoi:
List of all members.
Detailed Description
Noise module that outputs Voronoi cells.
In mathematics, a Voronoi cell is a region containing all the points that are closer to a specific seed point than to any other seed point. These cells mesh with one another, producing polygon-like formations.
By default, this noise module randomly places a seed point within each unit cube. By modifying the frequency of the seed points, an application can change the distance between seed points. The higher the frequency, the closer together this noise module places the seed points, which reduces the size of the cells. To specify the frequency of the cells, call the SetFrequency() method.
This noise module assigns each Voronoi cell with a random constant value from a coherent-noise function. The displacement value controls the range of random values to assign to each cell. The range of random values is +/- the displacement value. Call the SetDisplacement() method to specify the displacement value.
To modify the random positions of the seed points, call the SetSeed() method.
This noise module can optionally add the distance from the nearest seed to the output value. To enable this feature, call the EnableDistance() method. This causes the points in the Voronoi cells to increase in value the further away that point is from the nearest seed point.
Voronoi cells are often used to generate cracked-mud terrain formations or crystal-like textures
This noise module requires no source modules.
|
Public Member Functions |
| Voronoi () |
| Constructor.
|
void | EnableDistance (bool enable=true) |
| Enables or disables applying the distance from the nearest seed point to the output value.
|
double | GetDisplacement () const |
| Returns the displacement value of the Voronoi cells.
|
double | GetFrequency () const |
| Returns the frequency of the seed points.
|
virtual int | GetSourceModuleCount () const |
| Returns the number of source modules required by this noise module.
|
int | GetSeed () const |
| Returns the seed value used by the Voronoi cells.
|
bool | IsDistanceEnabled () const |
| Determines if the distance from the nearest seed point is applied to the output value.
|
virtual double | GetValue (double x, double y, double z) const |
| Generates an output value given the coordinates of the specified input value.
|
void | SetDisplacement (double displacement) |
| Sets the displacement value of the Voronoi cells.
|
void | SetFrequency (double frequency) |
| Sets the frequency of the seed points.
|
void | SetSeed (int seed) |
| Sets the seed value used by the Voronoi cells.
|
Protected Attributes |
double | m_displacement |
| Scale of the random displacement to apply to each Voronoi cell.
|
bool | m_enableDistance |
| Determines if the distance from the nearest seed point is applied to the output value.
|
double | m_frequency |
| Frequency of the seed points.
|
int | m_seed |
| Seed value used by the coherent-noise function to determine the positions of the seed points.
|
Constructor & Destructor Documentation
Member Function Documentation
void noise::module::Voronoi::EnableDistance |
( |
bool |
enable = true |
) |
[inline] |
|
|
Enables or disables applying the distance from the nearest seed point to the output value.
- Parameters:
-
| enable | Specifies whether to apply the distance to the output value or not. |
Applying the distance from the nearest seed point to the output value causes the points in the Voronoi cells to increase in value the further away that point is from the nearest seed point. Setting this value to true (and setting the displacement to a near-zero value) causes this noise module to generate cracked mud formations. |
double noise::module::Voronoi::GetDisplacement |
( |
|
) |
const [inline] |
|
|
Returns the displacement value of the Voronoi cells.
- Returns:
- The displacement value of the Voronoi cells.
This noise module assigns each Voronoi cell with a random constant value from a coherent-noise function. The displacement value controls the range of random values to assign to each cell. The range of random values is +/- the displacement value. |
double noise::module::Voronoi::GetFrequency |
( |
|
) |
const [inline] |
|
|
Returns the frequency of the seed points.
- Returns:
- The frequency of the seed points.
The frequency determines the size of the Voronoi cells and the distance between these cells. |
int noise::module::Voronoi::GetSeed |
( |
|
) |
const [inline] |
|
|
Returns the seed value used by the Voronoi cells.
- Returns:
- The seed value.
The positions of the seed values are calculated by a coherent-noise function. By modifying the seed value, the output of that function changes. |
virtual int noise::module::Voronoi::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 noise::module::Module. |
double Voronoi::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 noise::module::Module. |
bool noise::module::Voronoi::IsDistanceEnabled |
( |
|
) |
const [inline] |
|
|
Determines if the distance from the nearest seed point is applied to the output value.
- Returns:
- true if the distance is applied to the output value.
- false if not.
Applying the distance from the nearest seed point to the output value causes the points in the Voronoi cells to increase in value the further away that point is from the nearest seed point. |
void noise::module::Voronoi::SetDisplacement |
( |
double |
displacement |
) |
[inline] |
|
|
Sets the displacement value of the Voronoi cells.
- Parameters:
-
| displacement | The displacement value of the Voronoi cells. |
This noise module assigns each Voronoi cell with a random constant value from a coherent-noise function. The displacement value controls the range of random values to assign to each cell. The range of random values is +/- the displacement value. |
void noise::module::Voronoi::SetFrequency |
( |
double |
frequency |
) |
[inline] |
|
|
Sets the frequency of the seed points.
- Parameters:
-
| frequency | The frequency of the seed points. |
The frequency determines the size of the Voronoi cells and the distance between these cells. |
void noise::module::Voronoi::SetSeed |
( |
int |
seed |
) |
[inline] |
|
|
Sets the seed value used by the Voronoi cells.
- Parameters:
-
The positions of the seed values are calculated by a coherent-noise function. By modifying the seed value, the output of that function changes. |
The documentation for this class was generated from the following files:
|