![]() |
Public API Reference |
![]() |
Noise module that outputs the value selected from one of two source modules chosen by the output value from a control module. More...
#include <cstool/noise/module/select.h>
Public Member Functions | |
const Module & | GetControlModule () const |
Returns the control module. | |
double | GetEdgeFalloff () const |
Returns the falloff value at the edge transition. | |
double | GetLowerBound () const |
Returns the lower bound of the selection range. | |
virtual int | GetSourceModuleCount () const |
Returns the number of source modules required by this noise module. | |
double | GetUpperBound () const |
Returns the upper bound of the selection range. | |
virtual double | GetValue (double x, double y, double z) const |
Generates an output value given the coordinates of the specified input value. | |
Select () | |
Constructor. | |
void | SetBounds (double lowerBound, double upperBound) |
Sets the lower and upper bounds of the selection range. | |
void | SetControlModule (const Module &controlModule) |
Sets the control module. | |
void | SetEdgeFalloff (double edgeFalloff) |
Sets the falloff value at the edge transition. | |
Protected Attributes | |
double | m_edgeFalloff |
Edge-falloff value. | |
double | m_lowerBound |
Lower bound of the selection range. | |
double | m_upperBound |
Upper bound of the selection range. |
Noise module that outputs the value selected from one of two source modules chosen by the output value from a control module.
Unlike most other noise modules, the index value assigned to a source module determines its role in the selection operation:
To specify the bounds of the selection range, call the SetBounds() method.
An application can pass the control module to the SetControlModule() method instead of the SetSourceModule() method. This may make the application code easier to read.
By default, there is an abrupt transition between the output values from the two source modules at the selection-range boundary. To smooth the transition, pass a non-zero value to the SetEdgeFalloff() method. Higher values result in a smoother transition.
This noise module requires three source modules.
Constructor.
The default falloff value at the edge transition is set to CS::Math::Noise::Module::DEFAULT_SELECT_EDGE_FALLOFF.
The default lower bound of the selection range is set to CS::Math::Noise::Module::DEFAULT_SELECT_LOWER_BOUND.
The default upper bound of the selection range is set to CS::Math::Noise::Module::DEFAULT_SELECT_UPPER_BOUND.
const Module& CS::Math::Noise::Module::Select::GetControlModule | ( | ) | const [inline] |
Returns the control module.
CS::Math::Noise::ExceptionNoModule | See the preconditions for more information. |
The control module determines the output value to select. If the output value from the control module is within a range of values known as the selection range, the GetValue() method outputs the value from the source module with an index value of 1. Otherwise, this method outputs the value from the source module with an index value of 0.
double CS::Math::Noise::Module::Select::GetEdgeFalloff | ( | ) | const [inline] |
Returns the falloff value at the edge transition.
The falloff value is the width of the edge transition at either edge of the selection range.
By default, there is an abrupt transition between the output values from the two source modules at the selection-range boundary.
double CS::Math::Noise::Module::Select::GetLowerBound | ( | ) | const [inline] |
Returns the lower bound of the selection range.
If the output value from the control module is within the selection range, the GetValue() method outputs the value from the source module with an index value of 1. Otherwise, this method outputs the value from the source module with an index value of 0.
virtual int CS::Math::Noise::Module::Select::GetSourceModuleCount | ( | ) | const [inline, virtual] |
Returns the number of source modules required by this noise module.
Implements CS::Math::Noise::Module::Module.
double CS::Math::Noise::Module::Select::GetUpperBound | ( | ) | const [inline] |
Returns the upper bound of the selection range.
If the output value from the control module is within the selection range, the GetValue() method outputs the value from the source module with an index value of 1. Otherwise, this method outputs the value from the source module with an index value of 0.
virtual double CS::Math::Noise::Module::Select::GetValue | ( | double | x, |
double | y, | ||
double | z | ||
) | const [virtual] |
Generates an output value given the coordinates of the specified input value.
x | The x coordinate of the input value. |
y | The y coordinate of the input value. |
z | The z coordinate of the input value. |
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::Select::SetBounds | ( | double | lowerBound, |
double | upperBound | ||
) |
Sets the lower and upper bounds of the selection range.
lowerBound | The lower bound. |
upperBound | The upper bound. |
CS::Math::Noise::ExceptionInvalidParam | An invalid parameter was specified; see the preconditions for more information. |
If the output value from the control module is within the selection range, the GetValue() method outputs the value from the source module with an index value of 1. Otherwise, this method outputs the value from the source module with an index value of 0.
void CS::Math::Noise::Module::Select::SetControlModule | ( | const Module & | controlModule | ) | [inline] |
Sets the control module.
controlModule | The control module. |
The control module determines the output value to select. If the output value from the control module is within a range of values known as the selection range, the GetValue() method outputs the value from the source module with an index value of 1. Otherwise, this method outputs the value from the source module with an index value of 0.
This method assigns the control module an index value of 2. Passing the control module to this method produces the same results as passing the control module to the SetSourceModule() method while assigning that noise module an index value of 2.
This control module must exist throughout the lifetime of this noise module unless another control module replaces that control module.
void CS::Math::Noise::Module::Select::SetEdgeFalloff | ( | double | edgeFalloff | ) |
Sets the falloff value at the edge transition.
edgeFalloff | The falloff value at the edge transition. |
The falloff value is the width of the edge transition at either edge of the selection range.
By default, there is an abrupt transition between the values from the two source modules at the boundaries of the selection range.
For example, if the selection range is 0.5 to 0.8, and the edge falloff value is 0.1, then the GetValue() method outputs:
double CS::Math::Noise::Module::Select::m_edgeFalloff [protected] |
double CS::Math::Noise::Module::Select::m_lowerBound [protected] |
double CS::Math::Noise::Module::Select::m_upperBound [protected] |