Terrace

@addtogroup libnoise @{ @addtogroup modules @{ @addtogroup modifiermodules @{ Noise module that maps the output value from a source module onto a terrace-forming curve.

@image html moduleterrace.png

This noise module maps the output value from the source module onto a terrace-forming curve. The start of this curve has a slope of zero; its slope then smoothly increases. This curve also contains <i>control points</i> which resets the slope to zero at that point, producing a "terracing" effect. Refer to the following illustration:

@image html terrace.png

To add a control point to this noise module, call the AddControlPoint() method.

An application must add a minimum of two control points to the curve. If this is not done, the GetValue() method fails. The control points can have any value, although no two control points can have the same value. There is no limit to the number of control points that can be added to the curve.

This noise module clamps the output value from the source module if that value is less than the value of the lowest control point or greater than the value of the highest control point.

This noise module is often used to generate terrain features such as your stereotypical desert canyon.

This noise module requires one source module.

Constructors

this
this()

Constructor.

Destructor

~this
~this()

Destructor.

Members

Functions

AddControlPoint
void AddControlPoint(double value)

Adds a control point to the terrace-forming curve.

ClearAllControlPoints
void ClearAllControlPoints()

Deletes all the control points on the terrace-forming curve.

FindInsertionPos
int FindInsertionPos(double value)

Determines the array index in which to insert the control point into the internal control point array.

GetControlPointArray
const(double)[] GetControlPointArray()

Returns a pointer to the array of control points on the terrace-forming curve.

GetControlPointCount
int GetControlPointCount()

Returns the number of control points on the terrace-forming curve.

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.
InsertAtPos
void InsertAtPos(int insertionPos, double value)

Inserts the control point at the specified position in the internal control point array.

InvertTerraces
void InvertTerraces(bool invert)

Enables or disables the inversion of the terrace-forming curve between the control points.

IsTerracesInverted
bool IsTerracesInverted()

Determines if the terrace-forming curve between the control points is inverted.

MakeControlPoints
void MakeControlPoints(int controlPointCount)

Creates a number of equally-spaced control points that range from -1 to +1.

Variables

m_controlPointCount
int m_controlPointCount;

Number of control points stored in this noise module.

m_invertTerraces
bool m_invertTerraces;

Determines if the terrace-forming curve between all control points is inverted.

m_pControlPoints
double[] m_pControlPoints;

Array that stores the control 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