math
[proland]

Provides utility math functions. More...

Classes

struct  proland::seg2< type >
 A 2D segment. More...

Functions

PROLAND_API vec3f proland::rgb2hsl (const vec3f &rgb)
 Converts a color from rgb space to hsl space.
PROLAND_API vec3f proland::hsl2rgb (const vec3f &hsl)
 Converts a color from hsl space to rgb space.
PROLAND_API mat3f proland::dcolor (const vec3f &rgb, const vec3f &amp=vec3f(1/12.0f, 1/3.0f, 1/6.0f))
 Computes the derivates of an rgb color with respect to hsl coordinates.
template<typename type >
type proland::cross (const vec2< type > u, const vec2< type > &v)
 Returns the z coordinate of the cross product of this vector and of the given vector.
template<typename type >
bool proland::clipPoint (const box2< type > &box, const vec2< type > &a)
 Returns true if the given point is inside this bounding box.
template<typename type >
bool proland::clipRectangle (const box2< type > &box, const box2< type > &a)
 Returns true if the given box is inside or intersects this bounding box.
template<typename type >
bool proland::intersects (const box2< type > &box, const box2< type > &a)
 Alias for clipRectangle.
template<typename type >
bool proland::clipSegment (const box2< type > &box, const vec2< type > &a, const vec2< type > &b)
 Returns true if the given segment is inside or may intersect this bounding box.
template<typename type >
bool proland::clipQuad (const box2< type > &box, const vec2< type > &a, const vec2< type > &b, const vec2< type > &c)
 Returns true if the given quadratic Bezier arc is inside or may intersect this bounding box.
template<typename type >
bool proland::clipCubic (const box2< type > &box, const vec2< type > &a, const vec2< type > &b, const vec2< type > &c, const vec2< type > &d)
 Returns true if the given cubic Bezier arc is inside or may intersect this bounding box.
PROLAND_API long proland::lrandom (long *seed)
 Returns a pseudo random integer in the range 0-2147483647.
PROLAND_API float proland::frandom (long *seed)
 Returns a pseudo random float number in the range 0-1.
PROLAND_API float proland::grandom (float mean, float stdDeviation, long *seed)
 Returns a pseudo random float number with a Gaussian distribution.
PROLAND_API float proland::cnoise (float x, float y, int P=0)
 Computes the classic 2D Perlin noise function.
PROLAND_API float proland::cnoise (float x, float y, float z, int P=0)
 Computes the classic 3D Perlin noise function.
PROLAND_API float proland::snoise (float x, float y, int P=0)
 Computes the 2D Perlin simplex noise function.
PROLAND_API float proland::snoise (float x, float y, float z, int P=0)
 Computes the 3D Perlin simplex noise function.
PROLAND_API float proland::snoise (float x, float y, float z, float w, int P=0)
 Computes the 4D Perlin simplex noise function.
PROLAND_API float * proland::buildFbm4NoiseTexture2D (int size, int freq, int octaves, int lacunarity, float gain)
 Computes a 2D Fbm noise function in a 2D float array.
PROLAND_API float * proland::buildFbm1NoiseTexture3D (int size, int freq, int octaves, int lacunarity, float gain)
 Computes a 3D Fbm noise function in a 3D float array.

Detailed Description

Provides utility math functions.


Function Documentation

PROLAND_API float* proland::buildFbm1NoiseTexture3D ( int  size,
int  freq,
int  octaves,
int  lacunarity,
float  gain 
)

Computes a 3D Fbm noise function in a 3D float array.

This function is a sum of several Perlin noise function with different frequencies and amplitudes.

Parameters:
size the width, height and depth of the array of values to be computed.
freq the pseudo frequency of the lower frequency noise function. The corresponding pseudo period in pixels is size/freq.
octaves the number of Perlin noise functions to add.
lacunarity the frequency factor between each noise function.
gain the amplitude factor between each noise function.
Returns:
the computed size*size*size array of values. These values are normalized to stay in the range 0-1.
PROLAND_API float* proland::buildFbm4NoiseTexture2D ( int  size,
int  freq,
int  octaves,
int  lacunarity,
float  gain 
)

Computes a 2D Fbm noise function in a 2D float array.

This function is a sum of several Perlin noise function with different frequencies and amplitudes.

Parameters:
size the width and height of the array of values to be computed.
freq the pseudo frequency of the lower frequency noise function. The corresponding pseudo period in pixels is size/freq.
octaves the number of Perlin noise functions to add.
lacunarity the frequency factor between each noise function.
gain the amplitude factor between each noise function.
Returns:
the computed size*size array of values. These values are normalized to stay in the range 0-1.
template<typename type >
bool proland::clipCubic ( const box2< type > &  box,
const vec2< type > &  a,
const vec2< type > &  b,
const vec2< type > &  c,
const vec2< type > &  d 
) [inline]

Returns true if the given cubic Bezier arc is inside or may intersect this bounding box.

Parameters:
a Bezier arc extremity.
b first Bezier arc control point.
c second Bezier arc control point.
d the other Bezier arc extremity.
template<typename type >
bool proland::clipPoint ( const box2< type > &  box,
const vec2< type > &  a 
) [inline]

Returns true if the given point is inside this bounding box.

Parameters:
a an arbitrary point.
template<typename type >
bool proland::clipQuad ( const box2< type > &  box,
const vec2< type > &  a,
const vec2< type > &  b,
const vec2< type > &  c 
) [inline]

Returns true if the given quadratic Bezier arc is inside or may intersect this bounding box.

Parameters:
a Bezier arc extremity.
b Bezier arc control point.
c the other Bezier arc extremity.
template<typename type >
bool proland::clipRectangle ( const box2< type > &  box,
const box2< type > &  a 
) [inline]

Returns true if the given box is inside or intersects this bounding box.

Parameters:
a an arbitrary bounding box.
template<typename type >
bool proland::clipSegment ( const box2< type > &  box,
const vec2< type > &  a,
const vec2< type > &  b 
) [inline]

Returns true if the given segment is inside or may intersect this bounding box.

Parameters:
a a segment extremity.
b the other segment extremity.
PROLAND_API float proland::cnoise ( float  x,
float  y,
float  z,
int  P = 0 
)

Computes the classic 3D Perlin noise function.

Parameters:
x the x coordinate of the point where the function must be evaluated.
y the y coordinate of the point where the function must be evaluated.
z the z coordinate of the point where the function must be evaluated.
P an optional period to get a periodic noise function. The default value 0 means a non periodic function.
Returns:
the classic 3D Perlin noise function evaluated at (x,y,z). This function has a main frequency of 1, and its value are between -1 and 1.
PROLAND_API float proland::cnoise ( float  x,
float  y,
int  P = 0 
)

Computes the classic 2D Perlin noise function.

Parameters:
x the x coordinate of the point where the function must be evaluated.
y the y coordinate of the point where the function must be evaluated.
P an optional period to get a periodic noise function. The default value 0 means a non periodic function.
Returns:
the classic 2D Perlin noise function evaluated at (x,y). This function has a main frequency of 1, and its value are between -1 and 1.
template<typename type >
type proland::cross ( const vec2< type >  u,
const vec2< type > &  v 
) [inline]

Returns the z coordinate of the cross product of this vector and of the given vector.

PROLAND_API mat3f proland::dcolor ( const vec3f &  rgb,
const vec3f &  amp = vec3f(1/12.0f, 1/3.0f, 1/6.0f) 
)

Computes the derivates of an rgb color with respect to hsl coordinates.

Parameters:
rgb a color in rgb space.
amp scaling factors for each partial derivative.
Returns:
a matrix whose columns correspond to the partial derivatives drgb/dh, drgb/ds and drgb/dl, scaled by the factors amp.x, amp.y and amp.z.
PROLAND_API float proland::frandom ( long *  seed  )  [inline]

Returns a pseudo random float number in the range 0-1.

Parameters:
the seed used by this pseudo random generator. It is modified each time this function is called.
Returns:
a pseudo random float number in the range 0-1.
PROLAND_API float proland::grandom ( float  mean,
float  stdDeviation,
long *  seed 
) [inline]

Returns a pseudo random float number with a Gaussian distribution.

Parameters:
mean the mean of the Gaussian distribution.
stdDeviation the standard deviation of the Gaussian distribution (square root of its variance).
the seed used by this pseudo random generator. It is modified each time this function is called.
Returns:
a pseudo random float number with the given Gaussian distribution.
PROLAND_API vec3f proland::hsl2rgb ( const vec3f &  hsl  ) 

Converts a color from hsl space to rgb space.

Color coordinates in [0,1]

template<typename type >
bool proland::intersects ( const box2< type > &  box,
const box2< type > &  a 
) [inline]

Alias for clipRectangle.

PROLAND_API long proland::lrandom ( long *  seed  )  [inline]

Returns a pseudo random integer in the range 0-2147483647.

Parameters:
the seed used by this pseudo random generator. It is modified each time this function is called.
Returns:
a peudo random integer in the range 0-2147483647.
PROLAND_API vec3f proland::rgb2hsl ( const vec3f &  rgb  ) 

Converts a color from rgb space to hsl space.

Color coordinates in [0,1]

PROLAND_API float proland::snoise ( float  x,
float  y,
float  z,
float  w,
int  P = 0 
)

Computes the 4D Perlin simplex noise function.

Parameters:
x the x coordinate of the point where the function must be evaluated.
y the y coordinate of the point where the function must be evaluated.
z the z coordinate of the point where the function must be evaluated.
w the w coordinate of the point where the function must be evaluated.
P an optional period to get a periodic noise function. The default value 0 means a non periodic function.
Returns:
the 4D Perlin simplex noise function evaluated at (x,y,z,w). This function has a main frequency of 1, and its value are between -1 and 1.
PROLAND_API float proland::snoise ( float  x,
float  y,
float  z,
int  P = 0 
)

Computes the 3D Perlin simplex noise function.

Parameters:
x the x coordinate of the point where the function must be evaluated.
y the y coordinate of the point where the function must be evaluated.
z the z coordinate of the point where the function must be evaluated.
P an optional period to get a periodic noise function. The default value 0 means a non periodic function.
Returns:
the 3D Perlin simplex noise function evaluated at (x,y,z). This function has a main frequency of 1, and its value are between -1 and 1.
PROLAND_API float proland::snoise ( float  x,
float  y,
int  P = 0 
)

Computes the 2D Perlin simplex noise function.

Parameters:
x the x coordinate of the point where the function must be evaluated.
y the y coordinate of the point where the function must be evaluated.
P an optional period to get a periodic noise function. The default value 0 means a non periodic function.
Returns:
the 2D Perlin simplex noise function evaluated at (x,y). This function has a main frequency of 1, and its value are between -1 and 1.

Generated on Sat May 12 09:41:36 2012 for proland by  doxygen 1.6.1