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 &=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. |
Provides utility math functions.
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.
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. |
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.
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. |
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.
a | Bezier arc extremity. | |
b | first Bezier arc control point. | |
c | second Bezier arc control point. | |
d | the other Bezier arc extremity. |
bool proland::clipPoint | ( | const box2< type > & | box, | |
const vec2< type > & | a | |||
) | [inline] |
Returns true if the given point is inside this bounding box.
a | an arbitrary point. |
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.
a | Bezier arc extremity. | |
b | Bezier arc control point. | |
c | the other Bezier arc extremity. |
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.
a | an arbitrary bounding box. |
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.
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.
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. |
PROLAND_API float proland::cnoise | ( | float | x, | |
float | y, | |||
int | P = 0 | |||
) |
Computes the classic 2D Perlin noise function.
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. |
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.
rgb | a color in rgb space. | |
amp | scaling factors for each partial derivative. |
PROLAND_API float proland::frandom | ( | long * | seed | ) | [inline] |
Returns a pseudo random float number in the range 0-1.
the | seed used by this pseudo random generator. It is modified each time this function is called. |
PROLAND_API float proland::grandom | ( | float | mean, | |
float | stdDeviation, | |||
long * | seed | |||
) | [inline] |
Returns a pseudo random float number with a Gaussian distribution.
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. |
PROLAND_API vec3f proland::hsl2rgb | ( | const vec3f & | hsl | ) |
Converts a color from hsl space to rgb space.
Color coordinates in [0,1]
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.
the | seed used by this pseudo random generator. It is modified each time this function is called. |
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.
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. |
PROLAND_API float proland::snoise | ( | float | x, | |
float | y, | |||
float | z, | |||
int | P = 0 | |||
) |
Computes the 3D Perlin simplex noise function.
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. |
PROLAND_API float proland::snoise | ( | float | x, | |
float | y, | |||
int | P = 0 | |||
) |
Computes the 2D Perlin simplex noise function.
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. |