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
setLowerBound(double)
and setUpperBound(double)
methods.
- Source Modules
- This module requires one source module.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Default lower bound of the clamping range for theClamp
noise module.static final double
Default upper bound of the clamping range of theClamp
noise module.Fields inherited from class org.spongepowered.noise.module.NoiseModule
sourceModule
-
Constructor Summary
ConstructorsConstructorDescriptionClamp()
Clamp
(NoiseModule source) Create a new Clamp module with the source modules pre-configured. -
Method Summary
Modifier and TypeMethodDescriptiondouble
get
(double x, double y, double z) Generates an output value given the coordinates of the specified input value.double
Get the lower bound of the clamping range.void
setLowerBound
(double lowerBound) Set the lower bound of the clamping range.void
setUpperBound
(double upperBound) Set the upper bound of the clamping range.double
Get the upper bound of the clamping range.Methods inherited from class org.spongepowered.noise.module.NoiseModule
setSourceModule, sourceModule, sourceModuleCount
-
Field Details
-
Constructor Details
-
Clamp
public Clamp() -
Clamp
Create a new Clamp module with the source modules pre-configured.- Parameters:
source
- the input module
-
-
Method Details
-
lowerBound
public double lowerBound()Get the lower bound of 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.
- Returns:
- the lower bound
-
setLowerBound
public void setLowerBound(double lowerBound) Set the lower bound of the clamping range.The lower bound must be less than or equal to the upper bound.
- Parameters:
lowerBound
- the lower bound
-
upperBound
public double upperBound()Get the upper bound of the clamping range.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.
- Returns:
- the upper bound
-
setUpperBound
public void setUpperBound(double upperBound) Set the upper bound of the clamping range.The upper bound must be greater than or equal to the lower bound.
- Parameters:
upperBound
- the upper bound
-
get
public double get(double x, double y, double z) Description copied from class:NoiseModule
Generates an output value given the coordinates of the specified input value.All source modules required by this module must have been connected with the
NoiseModule.setSourceModule(int, NoiseModule)
method. If these source modules are not connected, this method will throw aNoModuleException
.To determine the number of source modules required by this noise module, call the
NoiseModule.sourceModuleCount()
method.- Specified by:
get
in classNoiseModule
- Parameters:
x
- thex
coordinate of the input valuey
- they
coordinate of the input valuez
- thez
coordinate of the input value- Returns:
- the output value
-