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.
- TLatticeNoise ()
- TLatticeNoise (const TLatticeNoise &)
Interface Category:
API.
Purpose:
- Default constructor.
- Copy constructor.
Calling Context:
- Called by the stream-in operators. Call this function directly.
- Called to copy an object. Call this function directly.
Parameters:
- Takes no parameters.
- const TLatticeNoise & -The object to be copied.
Return Value:
None.
Exceptions:
Throws no exceptions, passes all exceptions through.
Concurrency:
Not multithread safe.
Other Considerations:
None.
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.
- virtual double Noise (double point) const
- virtual double Noise (const TGPoint & point) const
- virtual double Noise (const TGPoint3D & point) const
Interface Category:
API.
Purpose:
- 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.
- 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.
- 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:
- Call this function directly.
- Call this function directly.
- Call this function directly.
Parameters:
- double point -The one-dimensional value used to generate the pseudo-random result.
- const TGPoint & point -The TGPoint used to generate the pseudo-random result.
- const TGPoint3D & point -The TGPoint3D used to generate the pseudo-random result.
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.
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:
- const TGPoint3D & point -The 3-D point used to generate the pseudo-random differential noise vector.
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
- virtual double Turbulence (double point, double pixelSize =0.1) const
- virtual double Turbulence (const TGPoint & point, double pixelSize =0.1) const
- virtual double Turbulence (const TGPoint3D & point, double pixelSize =0.1) const
Interface Category:
API.
Purpose:
- 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.
- 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.
- 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:
- Call this function directly.
- Call this function directly.
- Call this function directly.
Parameters:
- double point -The one-dimensional value used to generate the pseudo-random result.
- double pixelSize =0.1 -The approximate frequency of the turbulence with respect to a single pixel. The default value is 0.1. A value of 1.0 gives the same pseudo-random result as TLatticeNoise::Noise does when passed the same point value.
- const TGPoint & point -The 2-D value used to generate the pseudo-random result.
- double pixelSize =0.1 -The approximate frequency of the turbulence with respect to a single pixel. The default value is 0.1. A value of 1.0 gives the same pseudo-random result as TLatticeNoise::Noise does when passed the same point value.
- const TGPoint3D & point -The 3-D value used to generate the pseudo-random result.
- double pixelSize =0.1 -The approximate frequency of the turbulence with respect to a single pixel. The default value is 0.1. A value of 1.0 gives the same pseudo-random result as TLatticeNoise::Noise does when passed the same point value.
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:
- const TGPoint3D & point -The 3-D point used to generate the pseudo-random differential noise vector.
- double pixelSize =0.1 -The approximate frequency of the turbulence with respect to a single pixel. The default value is 0.A value of 1.0 gives the same pseudo-random result as TLatticeNoise::Noise does when passed the same point value.
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:
- TStream & -The stream that the object streams itself out to.
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:
- TStream & -The stream that the object streams itself in from.
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.