This noise module outputs concentric spheres centered on the origin like the concentric rings of an onion.
The first sphere has a radius of 1.0. Each subsequent sphere has a radius that is 1.0 unit larger than the previous sphere.
The output value from this noise module is determined by the distance between the input value and the nearest spherical surface. The input values that are located on a spherical surface are given the output value 1.0 and the input values that are equidistant from two spherical surfaces are given the output value -1.0.
An application can change the frequency of the concentric spheres.
Increasing the frequency reduces the distances between spheres. To specify
the frequency, call the setFrequency(double)
method.
This noise module, modified with some low-frequency, low-power turbulence, is useful for generating agate-like textures.
- Source Modules
- This module does not require any source modules.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
Default frequency value for theSpheres
noise module.Fields inherited from class org.spongepowered.noise.module.NoiseModule
sourceModule
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the frequency of the concentric spheres.double
get
(double x, double y, double z) Generates an output value given the coordinates of the specified input value.void
setFrequency
(double frequency) Sets the frequency of the concentric spheres.Methods inherited from class org.spongepowered.noise.module.NoiseModule
setSourceModule, sourceModule, sourceModuleCount
-
Field Details
-
DEFAULT_SPHERES_FREQUENCY
public static final double DEFAULT_SPHERES_FREQUENCYDefault frequency value for theSpheres
noise module.- See Also:
-
-
Constructor Details
-
Spheres
public Spheres()
-
-
Method Details
-
frequency
public double frequency()Get the frequency of the concentric spheres.Increasing the frequency increases the density of the concentric spheres, reducing the distances between them.
- Returns:
- the frequency of the concentric spheres
- See Also:
-
setFrequency
public void setFrequency(double frequency) Sets the frequency of the concentric spheres.Increasing the frequency increases the density of the concentric spheres, reducing the distances between them.
- Parameters:
frequency
- the frequency of the concentric spheres
-
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
-