Class Line


  • public class Line
    extends Object
    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 getValue(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 
      Constructor Description
      Line​(Module module)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      Module getModule()
      Returns the noise module that is used to generate the output values.
      double getValue​(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.
      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​(Module 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 Detail

      • Line

        public Line​(Module module)
        Parameters:
        module - The noise module that is used to generate the output values.
    • Method Detail

      • 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.
      • getModule

        public Module getModule()
        Returns the noise module that is used to generate the output values.
      • setModule

        public void setModule​(Module module)
        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.
      • getValue

        public double getValue​(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.