Class: TLatticeNoise

Declaration: GrafNoise.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TGrafNoise

Inherited By:

None.

Purpose:

TLatticeNoise is a concrete class, derived from TGrafNoise, that maps a small set of pseudo-random numbers to integer coordinates in 3-D space. Intermediary points are assigned interpolated values. By default, the TNoiseProcedureMap derived classes use TLatticeNoise to generate their texture maps. For its Noise member function, TLatticeNoise uses the following algorithm, proposed by K. Perlin in SIGGRAPH 1985: Associate a pseudo-random value with each point on the integer lattice. If a given input point (x,y,z) is on the integer lattice, return the noise value associated with that point on the lattice. On the other hand, if (x,y,z) is not on the lattice (meaning its coordinates are not all integers), use a cubic weighting function to interpolate the pseudo-random numbers that are mapped to the nearest integral points. Internally, TLatticeNoise stores the random numbers in an array of 256 items. To ensure that no noticeable pattern arises from this relatively small set of numbers, TLatticeNoise uses a heavily hashed table-lookup scheme based on the integer lattice coordinates. The Turbulence member function (which gives the visual impression of turbulent fluid flow) is generated from TLatticeNoise::Noise by adding several noise terms, each scaled by a term proportional to the inverse of their main frequency. (This function can be used to obtain a quick approximation to a 1/f signal.)

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

None.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TLatticeNoise::TLatticeNoise

  1. TLatticeNoise ()
  2. TLatticeNoise (const TLatticeNoise &)

Interface Category:

API.

Purpose:

  1. Default constructor.
  2. Copy constructor.

Calling Context:

  1. Called by the stream-in operators. Call this function directly.
  2. Called to copy an object. Call this function directly.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLatticeNoise::~TLatticeNoise

virtual ~ TLatticeNoise ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLatticeNoise::Noise

  1. virtual double Noise (double point) const
  2. virtual double Noise (const TGPoint & point) const
  3. virtual double Noise (const TGPoint3D & point) const

Interface Category:

API.

Purpose:

  1. Returns the pseudo-random noise value associated with position of the one-dimensional input argument. The noise algorithm is based on interpolation of a 3-D lattice of pseudo-random numbers.
  2. Returns the pseudo-random noise value associated with position of the 2-D input argument. The noise algorithm is based on interpolation of a 3-D lattice of pseudo-random numbers.
  3. Returns the pseudo-random noise value associated with position of the 3-D input argument. The noise algorithm is based on interpolation of a 3-D lattice of pseudo-random numbers.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.
  3. Call this function directly.

Parameters:

Return Value:

A floating point number with a range between 0 and 1, inclusive, which represents the pseudo-random number associated with the input argument.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLatticeNoise::DNoise

virtual TGPoint3D DNoise (const TGPoint3D & point) const

Interface Category:

API.

Purpose:

Returns the pseudo-random differential noise vector associated with the TGPoint3D argument. The noise algorithm is based on interpolation of a 3-D lattice of pseudo-random numbers.

Calling Context:

Call this function directly.

Parameters:

Return Value:

A TGPoint3D, each component of which has a range between -1 and 1, inclusive, which represents the differential noise vector associated with the input argument.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLatticeNoise::Turbulence

  1. virtual double Turbulence (double point, double pixelSize =0.1) const
  2. virtual double Turbulence (const TGPoint & point, double pixelSize =0.1) const
  3. virtual double Turbulence (const TGPoint3D & point, double pixelSize =0.1) const

Interface Category:

API.

Purpose:

  1. Returns a number between 0 and 1, inclusive, approximating a 1/f function (which gives the visual impression of turbulent fluid flow) when passed a one-dimensional value and a pixel size. The noise algorithm is based on interpolation of a 3-D lattice of pseudo-random numbers.
  2. Returns a number between 0 and 1, inclusive, approximating a 1/f function (which gives the visual impression of turbulent fluid flow) when passed a 2-D value and a pixel size. The noise algorithm is based on interpolation of a 3-D lattice of pseudo-random numbers.
  3. Returns a number between 0 and 1, inclusive, approximating a 1/f function (which gives the visual impression of turbulent fluid flow) when passed a 3-D value and a pixel size. The noise algorithm is based on interpolation of a 3-D lattice of pseudo-random numbers.

Calling Context:

  1. Call this function directly.
  2. Call this function directly.
  3. Call this function directly.

Parameters:

Return Value:

A floating point number with a range between 0 and 1, inclusive, which represents the pseudo-random number (modified by a turbulence function) associated with the input argument.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLatticeNoise::DTurbulence

virtual TGPoint3D DTurbulence (const TGPoint3D & point, double pixelSize =0.1) const

Interface Category:

API.

Purpose:

Returns the pseudo-random differential turbulence vector associated with the TGPoint3D argument. The noise algorithm is based on interpolation of a 3-D lattice of pseudo-random numbers.

Calling Context:

Call this function directly.

Parameters:

Return Value:

A TGPoint3D, each component of which has a range between -1 and 1, inclusive, which represents the differential turbulence vector associated with the input argument.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLatticeNoise::operator=

TLatticeNoise & operator =(const TLatticeNoise & source)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function by using the operator in an assignment statement.

Parameters:

Return Value:

A non-const reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLatticeNoise::operator>>=

virtual TStream & operator >>=(TStream &) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TLatticeNoise::operator<<=

virtual TStream & operator <<= (TStream &)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.