CrystalSpace

Public API Reference

CS::Math::Noise::Module::Clamp Class Reference
[Modifier Modules]

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

#include <cstool/noise/module/clamp.h>

Inheritance diagram for CS::Math::Noise::Module::Clamp:

List of all members.

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.

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.

Definition at line 68 of file clamp.h.


Constructor & Destructor Documentation

CS::Math::Noise::Module::Clamp::Clamp (  ) 

Constructor.

The default lower bound of the clamping range is set to CS::Math::Noise::Module::DEFAULT_CLAMP_LOWER_BOUND.

The default upper bound of the clamping range is set to CS::Math::Noise::Module::DEFAULT_CLAMP_UPPER_BOUND.


Member Function Documentation

double CS::Math::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.

Definition at line 89 of file clamp.h.

virtual int CS::Math::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 CS::Math::Noise::Module::Module.

Definition at line 94 of file clamp.h.

double CS::Math::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.

Definition at line 106 of file clamp.h.

virtual double CS::Math::Noise::Module::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 CS::Math::Noise::Module::Module.

void CS::Math::Noise::Module::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:
CS::Math::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.


Member Data Documentation

Lower bound of the clamping range.

Definition at line 134 of file clamp.h.

Upper bound of the clamping range.

Definition at line 137 of file clamp.h.


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

Generated for Crystal Space 2.1 by doxygen 1.6.1