Return value

intabs(
intv
)

Arguments

Return value

long longabs(
long longv
)

Arguments

long longv - Value.

Return value

Absolute value.

floatbezier(
const float *t, const float *v, floattime
)

Calculates the value of a cubic Bezier function for t = time.

A cubic Bezier curve is represented by 4 points. Po is the start point, P1 and P2 are control points 1 and 2 and P3 is the end point. The start and end point denote the beginning and end points of the path and the control points determine how the path moves from the start to the finish. As can be seen from the image, the only variable changing is t which determines how far the path has progressed from P0 to P3. Cubic Bezier curves are used as timing functions particularly for keyframe interpolation.

Arguments

const float *t - Coordinates of the four points of the curve along the horizontal T (times) axis in the range [0.0f, 1.0f].

const float *v - Coordinates of the four points of the curve along the vertical V (values) axis in the range [0.0f, 1.0f].

floattime - Time in the range [0, 1], for which the value of the Bezier function is to be calculated.

Return value

Value of the Bezier function.

doublebezier(
const float *t, const double *v, floattime
)

Calculates the value of a cubic Bezier function for t = time.

A cubic Bezier curve is represented by 4 points. Po is the start point, P1 and P2 are control points 1 and 2 and P3 is the end point. The start and end point denote the beginning and end points of the path and the control points determine how the path moves from the start to the finish. As can be seen from the image, the only variable changing is t which determines how far the path has progressed from P0 to P3. Cubic Bezier curves are used as timing functions particularly for keyframe interpolation.

Arguments

const float *t - Coordinates of the four points of the curve along the horizontal T (times) axis in the range [0.0f, 1.0f].

const double *v - Coordinates of the four points of the curve along the vertical V (values) axis in the range [0.0f, 1.0f].

floattime - Time in the range [0, 1], for which the value of the Bezier function is to be calculated.

Return value

Value of the Bezier function.

floatceil(
floatv
)

Ceiling function that returns the smallest integer value that is not less than the argument.

Source code

float a = ceil(3.141593); // a = 4.0

Arguments

floatv - Argument.

Return value

Smallest integer value not less than v.

doubleceil(
doublev
)

Ceiling function that returns the smallest integer value that is not less than the argument.

Source code

double a = ceil(3.141593); // a = 4.0

Arguments

doublev - Argument.

Return value

Smallest integer value not less than v.

doubleclamp(
doublev, doublev0, doublev1
)

Clamps a value within the specified min and max limits.

Arguments

doublev - Value to be clamped.

doublev0 - Minimum value.

doublev1 - Maximum value.

Return value

Clamped value.

floatclamp(
floatv, floatv0, floatv1
)

Clamps a value within the specified min and max limits.

Arguments

floatv - Value to be clamped.

floatv0 - Minimum value.

floatv1 - Maximum value.

Return value

Clamped value.

intclamp(
intv, intv0, intv1
)

Clamps a value within the specified min and max limits.

Arguments

intv - Value to be clamped.

intv0 - Minimum value.

intv1 - Maximum value.

Return value

Clamped value.

long longclamp(
long longv, long longv0, long longv1
)

Clamps a value within the specified min and max limits.

Arguments

long longv - Value to be clamped.

long longv0 - Minimum value.

long longv1 - Maximum value.

Return value

Clamped value.

dvec2clamp(
const dvec2 &v, const dvec2 &v0, const dvec2 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const dvec2 &v - Value to be clamped.

const dvec2 &v0 - Minimum value.

const dvec2 &v1 - Maximum value.

Return value

Clamped value.

ivec2clamp(
const ivec2 &v, const ivec2 &v0, const ivec2 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const ivec2 &v - The value.

const ivec2 &v0 - Minimum value.

const ivec2 &v1 - Maximum value.

Return value

Clamped value.

vec2clamp(
const vec2 &v, const vec2 &v0, const vec2 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const vec2 &v - Value to be clamped.

const vec2 &v0 - Minimum value.

const vec2 &v1 - Maximum value.

Return value

Clamped value.

dvec3clamp(
const dvec3 &v, const dvec3 &v0, const dvec3 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const dvec3 &v - Value to be clamped.

const dvec3 &v0 - Minimum value.

const dvec3 &v1 - Maximum value.

Return value

Clamped value.

ivec3clamp(
const ivec3 &v, const ivec3 &v0, const ivec3 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const ivec3 &v - Value to be clamped.

const ivec3 &v0 - Minimum value.

const ivec3 &v1 - Maximum value.

Return value

Clamped value.

vec3clamp(
const vec3 &v, const vec3 &v0, const vec3 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const vec3 &v - Value to be clamped.

const vec3 &v0 - Minimum value.

const vec3 &v1 - Maximum value.

Return value

Clamped value.

bvec4clamp(
const bvec4 &v, const bvec4 &v0, const bvec4 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const bvec4 &v - Value to be clamped.

const bvec4 &v0 - Minimum value.

const bvec4 &v1 - Maximum value.

Return value

Clamped value.

dvec4clamp(
const dvec4 &v, const dvec4 &v0, const dvec4 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const dvec4 &v - Value to be clamped.

const dvec4 &v0 - Minimum value.

const dvec4 &v1 - Maximum value.

Return value

Clamped value.

ivec4clamp(
const ivec4 &v, const ivec4 &v0, const ivec4 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const ivec4 &v - Value to be clamped.

const ivec4 &v0 - Minimum value.

const ivec4 &v1 - Maximum value.

Return value

Clamped value.

vec4clamp(
const vec4 &v, const vec4 &v0, const vec4 &v1
)

Clamps a value within the specified min and max limits.

Arguments

const vec4 &v - Value to be clamped.

const vec4 &v0 - Minimum value.

const vec4 &v1 - Maximum value.

Return value

Clamped value.

intcompare(
intv0, intv1
)

Compares two scalars of the int type.

Arguments

intv0 - First int scalar.

intv1 - Second int scalar.

Return value

1 if v0 is equal to v1; otherwise, 0.

intcompare(
floatv0, floatv1
)

Compares two scalars of the float type according to the degree of precision equal to 1.0e-6f.

Arguments

floatv0 - First float scalar.

floatv1 - Second float scalar.

Return value

1 if v0 is equal to v1; otherwise, 0.

intcompare(
doublev0, doublev1
)

Compares two scalars of the double type according to the degree of precision equal to 1.0e-6f.

Arguments

doublev0 - First double scalar.

doublev1 - Second double scalar.

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
floatv0, floatv1, floatepsilon
)

Compares two scalars of the float type according to the specified degree of precision.

Arguments

floatv0 - First scalar.

floatv1 - Second scalar.

floatepsilon - Epsilon (degree of precision).

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
doublev0, doublev1, doubleepsilon
)

Compares two scalars of the double type according to the specified degree of precision.

Arguments

doublev0 - First scalar.

doublev1 - Second scalar.

doubleepsilon - Epsilon (degree of precision).

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const vec2 &v0, const vec2 &v1
)

Compares two vectors according to the degree of precision equal to 1.0e-6f.

Arguments

const vec2 &v0 - First vector.

const vec2 &v1 - Second vector.

Return value

1 if v0 is equal to v1; otherwise, 0.

intcompare(
const vec2 &v0, const vec2 &v1, floatepsilon
)

Compares two vectors according to the specified degree of precision.

Arguments

const vec2 &v0 - First vector.

const vec2 &v1 - Second vector.

floatepsilon - Epsilon (degree of precision).

Return value

1 if v0 is equal to v1; otherwise, 0.

intcompare(
const dvec2 &v0, const dvec2 &v1
)

Compares two vectors according to the degree of precision equal to 1.0e-6f.

Arguments

const dvec2 &v0 - First vector.

const dvec2 &v1 - Second vector.

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const dvec2 &v0, const dvec2 &v1, doubleepsilon
)

Compares two vectors according to the specified degree of precision.

Arguments

const dvec2 &v0 - First vector.

const dvec2 &v1 - Second vector.

doubleepsilon - Epsilon (degree of precision).

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const vec3 &v0, const vec3 &v1
)

Compares two vectors according to the degree of precision equal to 1.0e-6f.

Arguments

const vec3 &v0 - First vector.

const vec3 &v1 - Second vector.

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const vec3 &v0, const vec3 &v1, floatepsilon
)

Compares two vectors according to the specified degree of precision.

Arguments

const vec3 &v0 - First vector.

const vec3 &v1 - Second vector.

floatepsilon - Epsilon (degree of precision).

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const dvec3 &v0, const dvec3 &v1
)

Compares two vectors according to the degree of precision equal to 1.0e-6f.

Arguments

const dvec3 &v0 - First vector.

const dvec3 &v1 - Second vector.

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const dvec3 &v0, const dvec3 &v1, doubleepsilon
)

Compares two vectors according to the specified degree of precision.

Arguments

const dvec3 &v0 - First vector.

const dvec3 &v1 - Second vector.

doubleepsilon - Epsilon (degree of precision).

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const vec4 &v0, const vec4 &v1
)

Compares two vectors according to the degree of precision equal to 1.0e-6f.

Arguments

const vec4 &v0 - First vector.

const vec4 &v1 - Second vector.

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const vec4 &v0, const vec4 &v1, floatepsilon
)

Compares two vectors according to the specified degree of precision.

Arguments

const vec4 &v0 - First vector.

const vec4 &v1 - Second vector.

floatepsilon - Epsilon (degree of precision).

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const dvec4 &v0, const dvec4 &v1
)

Compares two vectors according to the degree of precision equal to 1.0e-6f.

Arguments

const dvec4 &v0 - First vector.

const dvec4 &v1 - Second vector.

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const dvec4 &v0, const dvec4 &v1, doubleepsilon
)

Compares two vectors according to the specified degree of precision.

Arguments

const dvec4 &v0 - First vector.

const dvec4 &v1 - Second vector.

doubleepsilon - Epsilon (degree of precision).

Return value

1 if the v0 is equal to v1; otherwise, 0.

intcompare(
const quat &q0, const quat &q1
)

Compares two quaternions according to the degree of precision equal to 1.0e-6f.

Arguments

const quat &q0 - First quaternion.

const quat &q1 - Second quaternion.

Return value

1 if the q0 is equal to q1; otherwise, 0.

intcompare(
const quat &q0, const quat &q1, floatepsilon
)

Compares two quaternions according to the specified degree of precision.

Arguments

const quat &q0 - First quaternion.

const quat &q1 - Second quaternion.

floatepsilon - Epsilon (degree of precision).

Return value

1 if the q0 is equal to q1; otherwise, 0.

intcompare(
const mat2 &m0, const mat2 &m1
)

Compares two matrices according to the degree of precision equal to 1.0e-6f.

Arguments

const mat2 &m0 - First matrix.

const mat2 &m1 - Second matrix.

Return value

1 if the m0 is equal to m1; otherwise, 0.

intcompare(
const mat2 &m0, const mat2 &m1, floatepsilon
)

Compares two matrices according to the specified degree of precision.

Arguments

const mat2 &m0 - First matrix.

const mat2 &m1 - Second matrix.

floatepsilon - Epsilon (degree of precision).

Return value

1 if the m0 is equal to m1; otherwise, 0.

intcompare(
const mat3 &m0, const mat3 &m1
)

Compares two matrices according to the degree of precision equal to 1.0e-6f.

Arguments

const mat3 &m0 - First matrix.

const mat3 &m1 - Second matrix.

Return value

1 if the m0 is equal to m1; otherwise, 0.

intcompare(
const mat3 &m0, const mat3 &m1, floatepsilon
)

Compares two matrices according to the specified degree of precision.

Arguments

const mat3 &m0 - First matrix.

const mat3 &m1 - Second matrix.

floatepsilon - Epsilon (degree of precision).

Return value

1 if the m0 is equal to m1; otherwise, 0.

intcompare(
const mat4 &m0, const mat4 &m1
)

Compares two matrices according to the degree of precision equal to 1.0e-6f.

Arguments

const mat4 &m0 - First matrix.

const mat4 &m1 - Second matrix.

Return value

1 if the m0 is equal to m1; otherwise, 0.

intcompare(
const mat4 &m0, const mat4 &m1, floatepsilon
)

Compares two matrices according to the specified degree of precision.

Arguments

const mat4 &m0 - First matrix.

const mat4 &m1 - Second matrix.

floatepsilon - Epsilon (degree of precision).

Return value

1 if the m0 is equal to m1; otherwise, 0.

intcompare(
const dmat4 &m0, const dmat4 &m1
)

Compares two matrices according to the degree of precision equal to 1.0e-6f.

Arguments

const dmat4 &m0 - First matrix.

const dmat4 &m1 - Second matrix.

Return value

1 if the m0 is equal to m1; otherwise, 0.

intcompare(
const dmat4 &m0, const dmat4 &m1, doubleepsilon
)

Compares two matrices according to the specified degree of precision.

Arguments

const dmat4 &m0 - First matrix.

const dmat4 &m1 - Second matrix.

doubleepsilon - Epsilon (degree of precision).

Return value

1 if the m0 is equal to m1; otherwise, 0.

quatconjugate(
const quat &q
)

Returns the conjugate of a given quaternion.

Arguments

const quat &q - Quaternion.

Return value

Conjugate of a given quaternion.

floatcross(
const vec2 &v0, const vec2 &v1
)

Cross product of vectors.

Arguments

const vec2 &v0 - First vector.

const vec2 &v1 - Second vector.

Return value

Cross product of the two 2d vectors: v0.x * v1.y - v0.y*v1.x.

ivec3cross(
const ivec3 &v0, const ivec3 &v1
)

Cross product of vectors.

Arguments

const ivec3 &v0 - First vector.

const ivec3 &v1 - Second vector.

Return value

Resulting vector.

dvec3cross(
const dvec3 &v0, const dvec3 &v1
)

Cross product of vectors.

Arguments

const dvec3 &v0 - First vector.

const dvec3 &v1 - Second vector.

Return value

Resulting vector.

vec3cross(
const vec3 &v0, const vec3 &v1
)

Cross product of vectors.

Arguments

const vec3 &v0 - First vector.

const vec3 &v1 - Second vector.

Return value

Resulting vector.

ivec3 &cross(
ivec3 &ret, const ivec3 &v0, const ivec3 &v1
)

Cross product of vectors.

Arguments

ivec3 &ret - Output vector, to which the resulting vector will be put.

const ivec3 &v0 - First vector.

const ivec3 &v1 - Second vector.

Return value

Resulting vector.

vec3 &cross(
vec3 &ret, const vec3 &v0, const vec3 &v1
)

Cross product of vectors.

Arguments

vec3 &ret - Output vector, to which the resulting vector will be put.

const vec3 &v0 - First vector.

const vec3 &v1 - Second vector.

Return value

Resulting vector.

vec4 &cross(
vec4 &ret, const vec3 &v0, const vec3 &v1
)

Cross product of vectors.

Arguments

vec4 &ret - Output vector, to which the resulting vector will be put.

const vec3 &v0 - First vector.

const vec3 &v1 - Second vector.

Return value

Resulting vector.

dvec3 &cross(
dvec3 &ret, const dvec3 &v0, const dvec3 &v1
)

Cross product of vectors.

Arguments

dvec3 &ret - Output vector, to which the resulting vector will be put.

const dvec3 &v0 - First vector.

const dvec3 &v1 - Second vector.

Return value

Resulting vector.

dvec4 &cross(
dvec4 &ret, const dvec3 &v0, const dvec3 &v1
)

Cross product of vectors.

Arguments

dvec4 &ret - Output vector, to which the resulting vector will be put.

const dvec3 &v0 - First vector.

const dvec3 &v1 - Second vector.

Return value

Resulting vector.

doubledot(
const dvec2 &v0, const dvec2 &v1
)

Dot product of vectors.

Arguments

const dvec2 &v0 - First vector.

const dvec2 &v1 - Second vector.

Return value

Resulting scalar.

floatdot(
const vec3 &v0, const vec4 &v1
)

Dot product of vectors. In this case, w component of the four-component vector is added to the dot product of first three components of vectors.

Arguments

const vec3 &v0 - First vector.

const vec4 &v1 - Second vector.

Return value

Resulting scalar.

floatdot(
const vec4 &v0, const vec3 &v1
)

Dot product of vectors. In this case, w component of the four-component vector is added to the dot product of first three components of vectors.

Arguments

const vec4 &v0 - First vector.

const vec3 &v1 - Second vector.

Return value

Resulting scalar.

floatdot(
const vec4 &v0, const vec4 &v1
)

Dot product of vectors.

Arguments

const vec4 &v0 - First vector.

const vec4 &v1 - Second vector.

Return value

Resulting scalar.

floatdot(
const vec3 &v0, const vec3 &v1
)

Dot product of vectors.

Arguments

const vec3 &v0 - First vector.

const vec3 &v1 - Second vector.

Return value

Resulting scalar.

floatdot(
const vec2 &v0, const vec2 &v1
)

Dot product of vectors.

Arguments

const vec2 &v0 - First vector.

const vec2 &v1 - Second vector.

Return value

Resulting scalar.

intdot(
const ivec3 &v0, const ivec3 &v1
)

Dot product of vectors.

Arguments

const ivec3 &v0 - First vector.

const ivec3 &v1 - Second vector.

Return value

Resulting scalar.

intdot(
const ivec2 &v0, const ivec2 &v1
)

Dot product of vectors.

Arguments

const ivec2 &v0 - First vector.

const ivec2 &v1 - Second vector.

Return value

Resulting scalar.

intdot(
const ivec4 &v0, const ivec3 &v1
)

Dot product of vectors. In this case, w component of the four-component vector is added to the dot product of first three components of vectors.

Arguments

const ivec4 &v0 - First vector.

const ivec3 &v1 - Second vector.

Return value

Resulting scalar.

intdot(
const ivec4 &v0, const ivec4 &v1
)

Dot product of vectors.

Arguments

const ivec4 &v0 - First vector.

const ivec4 &v1 - Second vector.

Return value

Resulting scalar.

doubledot(
const dvec3 &v0, const dvec3 &v1
)

Dot product of vectors.

Arguments

const dvec3 &v0 - First vector.

const dvec3 &v1 - Second vector.

Return value

Resulting scalar.

doubledot(
const dvec3 &v0, const dvec4 &v1
)

Dot product of vectors. In this case, w component of the four-component vector is added to the dot product of first three components of vectors.

Arguments

const dvec3 &v0 - First vector.

const dvec4 &v1 - Second vector.

Return value

Resulting scalar.

doubledot(
const dvec4 &v0, const dvec3 &v1
)

Dot product of vectors. In this case, w component of the four-component vector is added to the dot product of first three components of vectors.

Arguments

const dvec4 &v0 - First vector.

const dvec3 &v1 - Second vector.

Return value

Resulting scalar.

doubledot(
const dvec4 &v0, const dvec4 &v1
)

Dot product of vectors.

Arguments

const dvec4 &v0 - First vector.

const dvec4 &v1 - Second vector.

Return value

Resulting scalar.

doubledot3(
const dvec3 &v0, const dvec4 &v1
)

Dot product of three components of vectors. W components of four-component vectors are ignored.

Arguments

Return value

intftoi(
floatv
)

Arguments

Return value

Integer value.

long longftol(
floatv
)

Converts a float value to a long value.

Arguments

floatv - Float value.

Return value

Long value.

floatgetAngle(
const quat &q0, const quat &q1
)

Returns the angle (in degrees) between the given first and second quaternions. The angle returned is the unsigned acute angle between the two quaternions. This means the smaller of the two possible angles is used.

Arguments

const quat &q0 - First quaternion (from which the angular difference is measured).

const quat &q1 - Second quaternion (to which the angular difference is measured).

Return value

Angle between the given quaternions, in degrees within the range [0.0; 180.0].

floatgetAngle(
const vec3 &v0, const vec3 &v1
)

Returns the angle (in degrees) between the given first and second vectors. The angle returned is the unsigned acute angle between the two vectors. This means the smaller of the two possible angles is used.

Arguments

const vec3 &v0 - First vector (from which the angular difference is measured).

const vec3 &v1 - Second vector (to which the angular difference is measured).

Return value

Angle between the given vectors, in degrees within the range [0.0; 180.0].

floatgetAngle(
const vec3 &v0, const vec3 &v1, const vec3 &up
)

Returns the signed angle (in degrees) between the given first and second vectors relative to the specified "up" vector.

Arguments

const vec3 &v0 - First vector (from which the angular difference is measured).

const vec3 &v1 - Second vector (to which the angular difference is measured).

const vec3 &up - Up vector, around which the other two vectors are rotated.

Return value

Angle between the given vectors, in degrees within the range [-180.0; 180.0].

floatgradient4(
floatx, const vec4 &gradient
)

Returns a gradient value for the specified argument using four key components. The gradient value is determined as follows:

Arguments

Return value

floatitof(
intv
)

Arguments

Return value

Scalaritos(
intv
)

Converts an integer value to a scalar value (float or double, depending on the precision).

Arguments

intv - Integer value.

Return value

Scalar value (float or double, depending on the precision).

floatlength(
const vec2 &v
)

Calculates the length of a given vector.

Arguments

const vec2 &v - Vector.

Return value

Vector length.

doublelength(
const dvec2 &v
)

Calculates the length of a given vector.

Arguments

const dvec2 &v - Vector.

Return value

Vector length.

floatlength(
const vec3 &v
)

Calculates the length of a given vector.

Arguments

const vec3 &v - Vector.

Return value

Vector length.

doublelength(
const dvec3 &v
)

Calculates the length of a given vector.

Arguments

const dvec3 &v - Vector.

Return value

Vector length.

floatlength(
const vec4 &v
)

Calculates the length of a given vector.

Arguments

const vec4 &v - Vector.

Return value

Vector length.

doublelength(
const dvec4 &v
)

Calculates the length of a given vector.

Arguments

const dvec4 &v - Vector.

Return value

Vector length.

floatlength2(
const vec2 &v
)

Calculates the squared length of a given vector. This method is much faster than length() - the calculation is basically the same only without the slow Sqrt call. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const vec2 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

doublelength2(
const dvec2 &v
)

Calculates the squared length of a given vector. This method is much faster than length() - the calculation is basically the same only without the slow Sqrt call. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const dvec2 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

intlength2(
const ivec2 &v
)

Calculates the squared length of a given vector. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const ivec2 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

floatlength2(
const vec3 &v
)

Calculates the squared length of a given vector. This method is much faster than length() - the calculation is basically the same only without the slow Sqrt call. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const vec3 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

doublelength2(
const dvec3 &v
)

Calculates the squared length of a given vector. This method is much faster than length() - the calculation is basically the same only without the slow Sqrt call. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const dvec3 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

intlength2(
const ivec3 &v
)

Calculates the squared length of a given vector. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const ivec3 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

floatlength2(
const vec4 &v
)

Calculates the squared length of a given vector. This method is much faster than length() - the calculation is basically the same only without the slow Sqrt call. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const vec4 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

doublelength2(
const dvec4 &v
)

Calculates the squared length of a given vector. This method is much faster than length() - the calculation is basically the same only without the slow Sqrt call. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const dvec4 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

intlength2(
const ivec4 &v
)

Calculates the squared length of a given vector. If you are using lengths simply to compare distances, then it is faster to compare squared lengths against the squares of distances as the comparison gives the same result.

Arguments

const ivec4 &v - Vector.

Return value

Squared length of the vector (X2 + Y2 + Z2).

floatlerp(
floatv0, floatv1, floatk
)

Returns the interpolated value according to the following formula: v0 + (v1 - v0) * k.

Arguments

floatv0 - First float value.

floatv1 - Second float value.

floatk - Interpolation coefficient.

Return value

Interpolated value.

doublelerp(
doublev0, doublev1, doublek
)

Returns the interpolated value according to the following formula: v0 + (v1 - v0) * k.

Arguments

doublev0 - First double value.

doublev1 - Second double value.

doublek - Interpolation coefficient.

Return value

Interpolated value.

intlerp(
intv0, intv1, intk
)

Returns the interpolated value according to the following formula: v0 + (v1 - v0) * k.

Arguments

intv0 - First int value.

intv1 - Second int value.

intk - Interpolation coefficient.

Return value

Interpolated value.

vec2lerp(
const vec2 &v0, const vec2 &v1, floatk
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const vec2 &v0 - First vector.

const vec2 &v1 - Second vector.

floatk - Interpolation coefficient.

Return value

Interpolated vector.

vec3lerp(
const vec3 &v0, const vec3 &v1, floatk
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const vec3 &v0 - First vector.

const vec3 &v1 - Second vector.

floatk - Interpolation coefficient.

Return value

Interpolated vector.

vec4lerp(
const vec4 &v0, const vec4 &v1, floatk
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const vec4 &v0 - First vector.

const vec4 &v1 - Second vector.

floatk - Interpolation coefficient.

Return value

Interpolated vector.

dvec2lerp(
const dvec2 &v0, const dvec2 &v1, doublek
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const dvec2 &v0 - First vector.

const dvec2 &v1 - Second vector.

doublek - Interpolation coefficient.

Return value

Interpolated vector.

dvec3lerp(
const dvec3 &v0, const dvec3 &v1, doublek
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const dvec3 &v0 - First vector.

const dvec3 &v1 - Second vector.

doublek - Interpolation coefficient.

Return value

Interpolated vector.

dvec4lerp(
const dvec4 &v0, const dvec4 &v1, doublek
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const dvec4 &v0 - First vector.

const dvec4 &v1 - Second vector.

doublek - Interpolation coefficient.

Return value

Interpolated vector.

ivec2lerp(
const ivec2 &v0, const ivec2 &v1, intk
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const ivec2 &v0 - First vector.

const ivec2 &v1 - Second vector.

intk - Interpolation coefficient.

Return value

Interpolated vector.

ivec3lerp(
const ivec3 &v0, const ivec3 &v1, intk
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const ivec3 &v0 - First vector.

const ivec3 &v1 - Second vector.

intk - Interpolation coefficient.

Return value

Interpolated vector.

ivec4lerp(
const ivec4 &v0, const ivec4 &v1, intk
)

Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.

Arguments

const ivec4 &v0 - First vector.

const ivec4 &v1 - Second vector.

intk - Interpolation coefficient.

Return value

Interpolated vector.

Typelerp(
Typev0, Typev1, Typek
)

Returns the interpolated value according to the following formula: v0 + (v1 - v0) * k.

Arguments

Typev0 - First value.

Typev1 - Second value.

Typek - Interpolation coefficient.

Return value

Interpolated value.

floatltof(
long longv
)

Converts a long value to a float value.

Arguments

long longv - Long value.

Return value

Float value.

doubleltod(
long longv
)

Converts a long value to a double value.

Arguments

long longv - Long value.

Return value

Double value.

floatmax(
floatv0, floatv1
)

Returns the maximum value.

Arguments

floatv0 - First value.

floatv1 - Second value.

Return value

Maximum value.

doublemax(
doublev0, doublev1
)

Returns the maximum value.

Arguments

doublev0 - First value.

doublev1 - Second value.

Return value

Maximum value.

intmax(
intv0, intv1
)

Returns the maximum value.

Arguments

intv0 - First value.

intv1 - Second value.

Return value

Maximum value.

long longmax(
long longv0, long longv1
)

Returns the maximum value.

Arguments

long longv0 - First value.

long longv1 - Second value.

Return value

Maximum value.

vec2max(
const vec2 &v0, const vec2 &v1
)

Returns the maximum value.

Arguments

const vec2 &v0 - First value.

const vec2 &v1 - Second value.

Return value

Maximum value.

vec3max(
const vec3 &v0, const vec3 &v1
)

Returns the maximum value.

Arguments

const vec3 &v0 - First value.

const vec3 &v1 - Second value.

Return value

Maximum value.

vec4max(
const vec4 &v0, const vec4 &v1
)

Returns the maximum value.

Arguments

const vec4 &v0 - First value.

const vec4 &v1 - Second value.

Return value

Maximum value.

dvec2max(
const dvec2 &v0, const dvec2 &v1
)

Returns the maximum value.

Arguments

const dvec2 &v0 - First value.

const dvec2 &v1 - Second value.

Return value

Maximum value.

dvec3max(
const dvec3 &v0, const dvec3 &v1
)

Returns the maximum value.

Arguments

const dvec3 &v0 - First value.

const dvec3 &v1 - Second value.

Return value

Maximum value.

dvec4max(
const dvec4 &v0, const dvec4 &v1
)

Returns the maximum value.

Arguments

const dvec4 &v0 - First value.

const dvec4 &v1 - Second value.

Return value

Maximum value.

ivec2max(
const ivec2 &v0, const ivec2 &v1
)

Returns the maximum value.

Arguments

const ivec2 &v0 - First value.

const ivec2 &v1 - Second value.

Return value

Maximum value.

ivec3max(
const ivec3 &v0, const ivec3 &v1
)

Returns the maximum value.

Arguments

const ivec3 &v0 - First value.

const ivec3 &v1 - Second value.

Return value

Maximum value.

ivec4max(
const ivec4 &v0, const ivec4 &v1
)

Returns the maximum value.

Arguments

const ivec4 &v0 - First value.

const ivec4 &v1 - Second value.

Return value

Maximum value.

bvec4max(
const bvec4 &v0, const bvec4 &v1
)

Returns the maximum value.

Arguments

const bvec4 &v0 - First value.

const bvec4 &v1 - Second value.

Return value

Maximum value.

Typemax(
Typev0, Typev1
)

Returns the maximum value.

Arguments

Typev0 - First value.

Typev1 - Second value.

Return value

Maximum value.

floatmin(
floatv0, floatv1
)

Returns the minimum value.

Arguments

floatv0 - First value.

floatv1 - Second value.

Return value

Minimum value.

doublemin(
doublev0, doublev1
)

Returns the minimum value.

Arguments

doublev0 - First value.

doublev1 - Second value.

Return value

Minimum value.

intmin(
intv0, intv1
)

Returns the minimum value.

Arguments

intv0 - First value.

intv1 - Second value.

Return value

Minimum value.

long longmin(
long longv0, long longv1
)

Returns the minimum value.

Arguments

long longv0 - First value.

long longv1 - Second value.

Return value

Minimum value.

vec2min(
const vec2 &v0, const vec2 &v1
)

Returns the minimum value.

Arguments

const vec2 &v0 - First value.

const vec2 &v1 - Second value.

Return value

Minimum value.

vec3min(
const vec3 &v0, const vec3 &v1
)

Returns the minimum value.

Arguments

const vec3 &v0 - First value.

const vec3 &v1 - Second value.

Return value

Minimum value.

vec4min(
const vec4 &v0, const vec4 &v1
)

Returns the minimum value.

Arguments

const vec4 &v0 - First value.

const vec4 &v1 - Second value.

Return value

Minimum value.

dvec2min(
const dvec2 &v0, const dvec2 &v1
)

Returns the minimum value.

Arguments

const dvec2 &v0 - First value.

const dvec2 &v1 - Second value.

Return value

Minimum value.

dvec3min(
const dvec3 &v0, const dvec3 &v1
)

Returns the minimum value.

Arguments

const dvec3 &v0 - First value.

const dvec3 &v1 - Second value.

Return value

Minimum value.

dvec4min(
const dvec4 &v0, const dvec4 &v1
)

Returns the minimum value.

Arguments

const dvec4 &v0 - First value.

const dvec4 &v1 - Second value.

Return value

Minimum value.

ivec2min(
const ivec2 &v0, const ivec2 &v1
)

Returns the minimum value.

Arguments

const ivec2 &v0 - First value.

const ivec2 &v1 - Second value.

Return value

Minimum value.

ivec3min(
const ivec3 &v0, const ivec3 &v1
)

Returns the minimum value.

Arguments

const ivec3 &v0 - First value.

const ivec3 &v1 - Second value.

Return value

Minimum value.

ivec4min(
const ivec4 &v0, const ivec4 &v1
)

Returns the minimum value.

Arguments

const ivec4 &v0 - First value.

const ivec4 &v1 - Second value.

Return value

Minimum value.

bvec4min(
const bvec4 &v0, const bvec4 &v1
)

Returns the minimum value.

Arguments

const bvec4 &v0 - First value.

const bvec4 &v1 - Second value.

Return value

Minimum value.

Typemin(
Typev0, Typev1
)

Returns the minimum value.

Arguments

Typev0 - First value.

Typev1 - Second value.

Return value

Minimum value.

intnpot(
intarg
)

Rounds up to the nearest power of two value.

Arguments

intarg - Argument.

Return value

The nearest upper power of 2 number.

floatrcp(
floatv
)

Returns the reciprocal of the specified argument.

Arguments

floatv - Argument.

Return value

Reciprocal of the argument.

doublercp(
doublev
)

Returns the reciprocal of the specified argument.

Arguments

doublev - Argument.

Return value

Reciprocal of the argument.

doubleround(
doublev
)

Rounds an argument to the nearest integer value.

Notice

In halfway cases, when an argument has a fractional part of exactly 0.5, the function rounds away from zero to the integer with larger magnitude.