libnoise logo

A portable, open-source, coherent noise-generating library for C++


noise::module::Clamp Class Reference
[Modifier Modules]

#include <clamp.h>

Inheritance diagram for noise::module::Clamp:

noise::module::Module List of all members.

Detailed Description

Noise module that clamps the output value from a source module to a range of values.

moduleclamp.png

The range of values in which to clamp the output value is called the clamping range.

If the output value from the source module is less than the lower bound of the clamping range, this noise module clamps that value to the lower bound. If the output value from the source module is greater than the upper bound of the clamping range, this noise module clamps that value to the upper bound.

To specify the upper and lower bounds of the clamping range, call the SetBounds() method.

This noise module requires one source module.


Public Member Functions

 Clamp ()
 Constructor.
double GetLowerBound () const
 Returns the lower bound of the clamping 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 clamping range.
virtual double GetValue (double x, double y, double z) const
 Generates an output value given the coordinates of the specified input value.
void SetBounds (double lowerBound, double upperBound)
 Sets the lower and upper bounds of the clamping range.

Protected Attributes

double m_lowerBound
 Lower bound of the clamping range.
double m_upperBound
 Upper bound of the clamping range.

Constructor & Destructor Documentation

Clamp::Clamp  ) 
 

Constructor.

The default lower bound of the clamping range is set to noise::module::DEFAULT_CLAMP_LOWER_BOUND.

The default upper bound of the clamping range is set to noise::module::DEFAULT_CLAMP_UPPER_BOUND.


Member Function Documentation

double noise::module::Clamp::GetLowerBound  )  const [inline]
 

Returns the lower bound of the clamping range.

Returns:
The lower bound.
If the output value from the source module is less than the lower bound of the clamping range, this noise module clamps that value to the lower bound.

virtual int noise::module::Clamp::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 noise::module::Clamp::GetUpperBound  )  const [inline]
 

Returns the upper bound of the clamping range.

Returns:
The upper bound.
If the output value from the source module is greater than the upper bound of the clamping range, this noise module clamps that value to the upper bound.

double Clamp::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.

void Clamp::SetBounds double  lowerBound,
double  upperBound
 

Sets the lower and upper bounds of the clamping range.

Parameters:
lowerBound The lower bound.
upperBound The upper bound.
Precondition:
The lower bound must be less than or equal to the upper bound.
Exceptions:
noise::ExceptionInvalidParam An invalid parameter was specified; see the preconditions for more information.
If the output value from the source module is less than the lower bound of the clamping range, this noise module clamps that value to the lower bound. If the output value from the source module is greater than the upper bound of the clamping range, this noise module clamps that value to the upper bound.

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