java.lang.Object
org.spongepowered.noise.model.Line
Model that defines the displacement of a line segment.
This model returns an output value from a noise module given the one-dimensional coordinate of an input value located on a line segment, which can be used as displacements.
This class is useful for creating:
- roads and rivers
- disaffected college students
To generate an output value, pass an input value between 0.0 and 1.0 to
the get(double)
method. 0.0
represents the start
position of the line segment and 1.0
represents the end position
of the line segment.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns a flag indicating whether the output value is to be attenuated (moved toward 0.0) as the ends of the line segment are approached by the input value.double
get
(double p) Returns the output value from the noise module given the one-dimensional coordinate of the specified input value located on the line segment.module()
Returns the noise module that is used to generate the output values.void
setAttenuate
(boolean att) Sets a flag indicating that the output value is to be attenuated (moved toward 0.0) as the ends of the line segment are approached.void
setEndPoint
(double x, double y, double z) Sets the position (x
,y
,z
) of the end of the line segment to choose values along.void
setModule
(NoiseModule module) Sets the noise module that is used to generate the output values.void
setStartPoint
(double x, double y, double z) Sets the position (x
,y
,z
) of the start of the line segment to choose values along.
-
Constructor Details
-
Line
- Parameters:
module
- The noise module that is used to generate the output values.
-
-
Method Details
-
attenuate
public boolean attenuate()Returns a flag indicating whether the output value is to be attenuated (moved toward 0.0) as the ends of the line segment are approached by the input value.- Returns:
- true if the value is to be attenuated false if not.
-
setAttenuate
public void setAttenuate(boolean att) Sets a flag indicating that the output value is to be attenuated (moved toward 0.0) as the ends of the line segment are approached.- Parameters:
att
- A flag that specifies whether the output value is to be attenuated.
-
setStartPoint
public void setStartPoint(double x, double y, double z) Sets the position (x
,y
,z
) of the start of the line segment to choose values along.- Parameters:
x
- x coordinate of the start position.y
- y coordinate of the start position.z
- z coordinate of the start position.
-
setEndPoint
public void setEndPoint(double x, double y, double z) Sets the position (x
,y
,z
) of the end of the line segment to choose values along.- Parameters:
x
- x coordinate of the end position.y
- y coordinate of the end position.z
- z coordinate of the end position.
-
module
Returns the noise module that is used to generate the output values.- Returns:
- the module used to generate output values
-
setModule
Sets the noise module that is used to generate the output values.This noise module must exist for the lifetime of this object, until you pass a new noise module to this method.
- Parameters:
module
- The noise module that is used to generate the output values.
-
get
public double get(double p) Returns the output value from the noise module given the one-dimensional coordinate of the specified input value located on the line segment.- Parameters:
p
- The distance along the line segment (ranges from 0.0 to 1.0)- Returns:
- The output value from the noise module.
-