Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ShFunc.hpp File Reference

Miscellaneous small Sh utility functions. More...

#include "ShVariable.hpp"
#include "ShAttrib.hpp"
#include "ShFuncImpl.hpp"

Include dependency graph for ShFunc.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  ShUtil

Functions

template<int N, typename T>
ShGeneric< N, T > smoothstep (const ShGeneric< N, T > &a, const ShGeneric< N, T > &b, const ShGeneric< N, T > x)
 Cubic interpolated step between 0 and 1. Returns 0 if x < a, 1 if x > b, cubic interpolation between 0 and 1 otherwise.
template<int N, typename T>
ShGeneric< 1, T > distance (const ShGeneric< N, T > &a, const ShGeneric< N, T > &b)
 Euclidean distance between two points.
template<int N, typename T>
ShGeneric< 1, T > lOneDistance (const ShGeneric< N, T > &a, const ShGeneric< N, T > &b)
 L1 distance between two points The L1 distance is a sum of the absolute component-wise differences.
template<int N, typename T>
ShGeneric< 1, T > lInfDistance (const ShGeneric< N, T > &a, const ShGeneric< N, T > &b)
 Linfinity distance between two points Linfinity distance is the maximum absolute component-wise difference.
template<int N, typename T>
ShGeneric< N, T > hashlcg (const ShGeneric< N, T > &p)
 Parallel linear congruential generator.
template<int N, typename T>
ShGeneric< N, T > hashmrg (const ShGeneric< N, T > &p)
 MRG style pseudorandom vector generator.
template<int N, ShBindingType Binding, typename T>
ShAttrib< N, Binding, T > evenOddSort (const ShAttrib< N, Binding, T > &v)
 Sorts components of an n-tuple Uses an even-odd transposition sort to sort the components of an n-tuple. (Ordered from smallest to largset).
template<int S, int N, ShBindingType Binding, typename T>
void groupEvenOddSort (ShAttrib< N, Binding, T > v[])
 Sorts groups of components v[i](j), 0 <= i < S * by the components in v[0](j) 0 <= j < N. * This also uses an even-odd transposition sort.
template<typename T>
ShGeneric< 3, T > changeBasis (const ShGeneric< 3, T > &b0, const ShGeneric< 3, T > &b1, const ShGeneric< 3, T > &b2, const ShGeneric< 3, T > &v)
 Given 3 orthonormal basis vectors b0, b1, b2, specified relative to a coordinate space C, this does a change of basis on a vector v in space C to the orthonormal basis.


Detailed Description

Miscellaneous small Sh utility functions.

Definition in file ShFunc.hpp.


Function Documentation

template<int N, typename T>
ShGeneric< N, T > ShUtil::hashlcg const ShGeneric< N, T > &  p  ) 
 

Parallel linear congruential generator.

This does not work very well right now. Use hashmrg instead.

See also:
template<int N, typename T> ShGeneric<N, T> hashmrg(const ShGeneric<N, T>& p)

Definition at line 91 of file ShFuncImpl.hpp.

References SH::frac(), and SH::mad().

template<int N, typename T>
ShGeneric< N, T > ShUtil::hashmrg const ShGeneric< N, T > &  p  ) 
 

MRG style pseudorandom vector generator.

Generates a random vector using a multiple-recursive generator style. (LCG on steroids) Treat x,y,z,w as seeds a0, a1, a2, a3 and repeatedly apply an = b * (an-1, an-2, an-3, an-4), where b is a vector Take as output (an, an-1, an-2, an3) after suitable number of iterations.

This appears to reduce correlation in the output components when input components are similar, but the behaviour needs to be studied further.

See also:
template<int N, typename T> ShGeneric<N, T> hashlcg(const ShGeneric<N, T>& p)

Definition at line 121 of file ShFuncImpl.hpp.

References SH::dot(), and SH::frac().

Referenced by ShUtil::ShNoise< M, T, P >::cellnoise(), and ShUtil::ShNoise< M, T, P >::perlin().


Generated on Mon Jan 24 18:36:55 2005 for Sh by  doxygen 1.4.1