Voronoi

Noise module that outputs Voronoi cells.

@image html modulevoronoi.png

In mathematics, a <i>Voronoi cell</i> is a region containing all the points that are closer to a specific <i>seed point</i> 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 <i>frequency</i> 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 <i>displacement value</i> 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.

Constructors

this
this()

Constructor.

Members

Functions

EnableDistance
void EnableDistance(bool enable)

Enables or disables applying the distance from the nearest seed point to the output value.

GetDisplacement
double GetDisplacement()

Returns the displacement value of the Voronoi cells.

GetFrequency
double GetFrequency()

Returns the frequency of the seed points.

GetSeed
int GetSeed()

Returns the seed value used by the Voronoi cells

GetSourceModCount
int GetSourceModCount()
Undocumented in source. Be warned that the author may not have intended to support it.
GetValue
double GetValue(double x, double y, double z)
Undocumented in source. Be warned that the author may not have intended to support it.
IsDistanceEnabled
bool IsDistanceEnabled()

Determines if the distance from the nearest seed point is applied to the output value.

SetDisplacement
void SetDisplacement(double displacement)

Sets the displacement value of the Voronoi cells.

SetFrequency
void SetFrequency(double frequency)

Sets the frequency of the seed points.

SetSeed
void SetSeed(int seed)

Sets the seed value used by the Voronoi cells

Variables

m_displacement
double m_displacement;

Scale of the random displacement to apply to each Voronoi cell.

m_enableDistance
bool m_enableDistance;

Determines if the distance from the nearest seed point is applied to the output value.

m_frequency
double m_frequency;

Frequency of the seed points.

m_seed
int m_seed;

Seed value used by the coherent-noise function to determine the positions of the seed points.

Inherited Members

From Mod

~this
~this()

Destructor.

GetSourceMod
const(Mod) GetSourceMod(int index)

Returns a reference to a source module connected to this noise module.

GetSourceModCount
int GetSourceModCount()

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

GetValue
double GetValue(double x, double y, double z)

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

SetSourceMod
void SetSourceMod(int index, const(Mod)* sourceMod)

Connects a source module to this noise module.

m_pSourceMod
const(Mod)*[] m_pSourceMod;

An array containing the pointers to each source module required by this noise module.

Meta