libnoise logo

A portable, open-source, coherent noise-generating library for C++


noise::model::Line Class Reference
[Models]

#include <line.h>

List of all members.


Detailed Description

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() method. 0.0 represents the start position of the line segment and 1.0 represents the end position of the line segment.


Public Member Functions

 Line ()
 Constructor.
 Line (const module::Module &module)
 Constructor.
bool GetAttenuate () const
 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.
const module::ModuleGetModule () const
 Returns the noise module that is used to generate the output values.
double GetValue (double p) const
 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 (bool 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 (const module::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 & Destructor Documentation

Line::Line const module::Module module  ) 
 

Constructor.

Parameters:
module The noise module that is used to generate the output values.

Member Function Documentation

bool noise::model::Line::GetAttenuate  )  const [inline]
 

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.

const module::Module& noise::model::Line::GetModule  )  const [inline]
 

Returns the noise module that is used to generate the output values.

Returns:
A reference to the noise module.
Precondition:
A noise module was passed to the SetModule() method.

double Line::GetValue double  p  )  const
 

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.
Precondition:
A noise module was passed to the SetModule() method.

The start and end points of the line segment were specified.

The output value is generated by the noise module passed to the SetModule() method. This value may be attenuated (moved toward 0.0) as p approaches either end of the line segment; this is the default behavior.

If the value is not to be attenuated, p can safely range outside the 0.0 to 1.0 range; the output value will be extrapolated along the line that this segment is part of.

void noise::model::Line::SetAttenuate bool  att  )  [inline]
 

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.

void noise::model::Line::SetEndPoint double  x,
double  y,
double  z
[inline]
 

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.

void noise::model::Line::SetModule const module::Module module  )  [inline]
 

Sets the noise module that is used to generate the output values.

Parameters:
module 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.

void noise::model::Line::SetStartPoint double  x,
double  y,
double  z
[inline]
 

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.

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