Math Common Functions
float abs(float v)
Returns the absolute value of the argument.Arguments
- float v - Float value.
Return value
Absolute value.double abs(double v)
Returns the absolute value of the argument.Arguments
- double v - Value.
Return value
Absolute value.int abs(int v)
Returns the absolute value of the argument.Arguments
- int v - Value.
Return value
Absolute value.long long abs(long long v)
Returns the absolute value of the argument.Arguments
- long long v - Value.
Return value
Absolute value.float bezier(const float * t, const float * v, float time)
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].
- float time - 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.double bezier(const float * t, const double * v, float time)
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].
- float time - 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.float ceil(float v)
Ceiling function that returns the smallest integer value that is not less than the argument.float a = ceil(3.141593); // a = 4.0
Arguments
- float v - Argument.
Return value
Smallest integer value not less than v.double ceil(double v)
Ceiling function that returns the smallest integer value that is not less than the argument.double a = ceil(3.141593); // a = 4.0
Arguments
- double v - Argument.
Return value
Smallest integer value not less than v.double clamp(double v, double v0, double v1)
Clamps a value within the specified min and max limits.Arguments
- double v - Value to be clamped.
- double v0 - Minimum value.
- double v1 - Maximum value.
Return value
Clamped value.float clamp(float v, float v0, float v1)
Clamps a value within the specified min and max limits.Arguments
- float v - Value to be clamped.
- float v0 - Minimum value.
- float v1 - Maximum value.
Return value
Clamped value.int clamp(int v, int v0, int v1)
Clamps a value within the specified min and max limits.Arguments
- int v - Value to be clamped.
- int v0 - Minimum value.
- int v1 - Maximum value.
Return value
Clamped value.long long clamp(long long v, long long v0, long long v1)
Clamps a value within the specified min and max limits.Arguments
- long long v - Value to be clamped.
- long long v0 - Minimum value.
- long long v1 - Maximum value.
Return value
Clamped value.dvec2 clamp(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.ivec2 clamp(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.vec2 clamp(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.dvec3 clamp(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.ivec3 clamp(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.vec3 clamp(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.bvec4 clamp(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.dvec4 clamp(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.ivec4 clamp(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.vec4 clamp(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.int compare(int v0, int v1)
Compares two scalars of the int type.Arguments
- int v0 - First int scalar.
- int v1 - Second int scalar.
Return value
1 if v0 is equal to v1; otherwise, 0.int compare(float v0, float v1)
Compares two scalars of the float type according to the degree of precision equal to 1.0e-6f.Arguments
- float v0 - First float scalar.
- float v1 - Second float scalar.
Return value
1 if v0 is equal to v1; otherwise, 0.int compare(double v0, double v1)
Compares two scalars of the double type according to the degree of precision equal to 1.0e-6f.Arguments
- double v0 - First double scalar.
- double v1 - Second double scalar.
Return value
1 if the v0 is equal to v1; otherwise, 0.int compare(float v0, float v1, float epsilon)
Compares two scalars of the float type according to the specified degree of precision.Arguments
- float v0 - First scalar.
- float v1 - Second scalar.
- float epsilon - Epsilon (degree of precision).
Return value
1 if the v0 is equal to v1; otherwise, 0.int compare(double v0, double v1, double epsilon)
Compares two scalars of the double type according to the specified degree of precision.Arguments
- double v0 - First scalar.
- double v1 - Second scalar.
- double epsilon - Epsilon (degree of precision).
Return value
1 if the v0 is equal to v1; otherwise, 0.int compare(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.int compare(const vec2 & v0, const vec2 & v1, float epsilon)
Compares two vectors according to the specified degree of precision.Arguments
- const vec2 & v0 - First vector.
- const vec2 & v1 - Second vector.
- float epsilon - Epsilon (degree of precision).
Return value
1 if v0 is equal to v1; otherwise, 0.int compare(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.int compare(const dvec2 & v0, const dvec2 & v1, double epsilon)
Compares two vectors according to the specified degree of precision.Arguments
- const dvec2 & v0 - First vector.
- const dvec2 & v1 - Second vector.
- double epsilon - Epsilon (degree of precision).
Return value
1 if the v0 is equal to v1; otherwise, 0.int compare(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.int compare(const vec3 & v0, const vec3 & v1, float epsilon)
Compares two vectors according to the specified degree of precision.Arguments
- const vec3 & v0 - First vector.
- const vec3 & v1 - Second vector.
- float epsilon - Epsilon (degree of precision).
Return value
1 if the v0 is equal to v1; otherwise, 0.int compare(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.int compare(const dvec3 & v0, const dvec3 & v1, double epsilon)
Compares two vectors according to the specified degree of precision.Arguments
- const dvec3 & v0 - First vector.
- const dvec3 & v1 - Second vector.
- double epsilon - Epsilon (degree of precision).
Return value
1 if the v0 is equal to v1; otherwise, 0.int compare(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.int compare(const vec4 & v0, const vec4 & v1, float epsilon)
Compares two vectors according to the specified degree of precision.Arguments
- const vec4 & v0 - First vector.
- const vec4 & v1 - Second vector.
- float epsilon - Epsilon (degree of precision).
Return value
1 if the v0 is equal to v1; otherwise, 0.int compare(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.int compare(const dvec4 & v0, const dvec4 & v1, double epsilon)
Compares two vectors according to the specified degree of precision.Arguments
- const dvec4 & v0 - First vector.
- const dvec4 & v1 - Second vector.
- double epsilon - Epsilon (degree of precision).
Return value
1 if the v0 is equal to v1; otherwise, 0.int compare(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.int compare(const quat & q0, const quat & q1, float epsilon)
Compares two quaternions according to the specified degree of precision.Arguments
- const quat & q0 - First quaternion.
- const quat & q1 - Second quaternion.
- float epsilon - Epsilon (degree of precision).
Return value
1 if the q0 is equal to q1; otherwise, 0.int compare(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.int compare(const mat2 & m0, const mat2 & m1, float epsilon)
Compares two matrices according to the specified degree of precision.Arguments
- const mat2 & m0 - First matrix.
- const mat2 & m1 - Second matrix.
- float epsilon - Epsilon (degree of precision).
Return value
1 if the m0 is equal to m1; otherwise, 0.int compare(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.int compare(const mat3 & m0, const mat3 & m1, float epsilon)
Compares two matrices according to the specified degree of precision.Arguments
- const mat3 & m0 - First matrix.
- const mat3 & m1 - Second matrix.
- float epsilon - Epsilon (degree of precision).
Return value
1 if the m0 is equal to m1; otherwise, 0.int compare(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.int compare(const mat4 & m0, const mat4 & m1, float epsilon)
Compares two matrices according to the specified degree of precision.Arguments
- const mat4 & m0 - First matrix.
- const mat4 & m1 - Second matrix.
- float epsilon - Epsilon (degree of precision).
Return value
1 if the m0 is equal to m1; otherwise, 0.int compare(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.int compare(const dmat4 & m0, const dmat4 & m1, double epsilon)
Compares two matrices according to the specified degree of precision.Arguments
- const dmat4 & m0 - First matrix.
- const dmat4 & m1 - Second matrix.
- double epsilon - Epsilon (degree of precision).
Return value
1 if the m0 is equal to m1; otherwise, 0.float cross(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.ivec3 cross(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.dvec3 cross(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.vec3 cross(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.double dot(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.float dot(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.float dot(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.float dot(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.float dot(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.float dot(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.int dot(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.int dot(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.int dot(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.int dot(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.double dot(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.double dot(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.double dot(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.double dot(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.double dot3(const dvec3 & v0, const dvec4 & v1)
Dot product of three components of vectors. W components of four-component vectors are ignored.float a = dot3(vec3(1, 2, 3), vec4(1, 2, 3, 4));
double b = dot3(dvec4(1, 2, 3, 4), dvec4(1, 2, 3, 4));
/*
result is:
a = 14.000000
b = 14.000000
*/
Arguments
- const dvec3 & v0 - First vector.
- const dvec4 & v1 - Second vector.
Return value
Resulting scalar.double dot3(const dvec4 & v0, const dvec3 & v1)
Dot product of three components of vectors. W components of four-component vectors are ignored.float a = dot3(vec3(1, 2, 3), vec4(1, 2, 3, 4));
double b = dot3(dvec4(1, 2, 3, 4), dvec4(1, 2, 3, 4));
/*
result is:
a = 14.000000
b = 14.000000
*/
Arguments
- const dvec4 & v0 - First vector.
- const dvec3 & v1 - Second vector.
Return value
Resulting scalar.double dot3(const dvec4 & v0, const dvec4 & v1)
Dot product of three components of vectors. W components of four-component vectors are ignored.float a = dot3(vec3(1, 2, 3), vec4(1, 2, 3, 4));
double b = dot3(dvec4(1, 2, 3, 4), dvec4(1, 2, 3, 4));
/*
result is:
a = 14.000000
b = 14.000000
*/
Arguments
- const dvec4 & v0 - First vector.
- const dvec4 & v1 - Second vector.
Return value
Resulting scalar.float dot3(const vec3 & v0, const vec4 & v1)
Dot product of three components of vectors. W components of four-component vectors are ignored.float a = dot3(vec3(1, 2, 3), vec4(1, 2, 3, 4));
double b = dot3(dvec4(1, 2, 3, 4), dvec4(1, 2, 3, 4));
/*
result is:
a = 14.000000
b = 14.000000
*/
Arguments
- const vec3 & v0 - First vector.
- const vec4 & v1 - Second vector.
Return value
Resulting scalar.float dot3(const vec4 & v0, const vec3 & v1)
Dot product of three components of vectors. W components of four-component vectors are ignored.float a = dot3(vec3(1, 2, 3), vec4(1, 2, 3, 4));
double b = dot3(dvec4(1, 2, 3, 4), dvec4(1, 2, 3, 4));
/*
result is:
a = 14.000000
b = 14.000000
*/
Arguments
- const vec4 & v0 - First vector.
- const vec3 & v1 - Second vector.
Return value
Resulting scalar.float dot3(const vec4 & v0, const vec4 & v1)
Dot product of three components of vectors. W components of four-component vectors are ignored.float a = dot3(vec3(1, 2, 3), vec4(1, 2, 3, 4));
double b = dot3(dvec4(1, 2, 3, 4), dvec4(1, 2, 3, 4));
/*
result is:
a = 14.000000
b = 14.000000
*/
Arguments
- const vec4 & v0 - First vector.
- const vec4 & v1 - Second vector.
Return value
Resulting scalar.int dtoi(double v)
Converts a double value to an integer value.Arguments
- double v - Double value.
Return value
Integer value.long long dtol(double v)
Converts a double value to an integer value.Arguments
- double v - Double value.
Return value
Long value.double floor(double v)
Rounds an argument down to the nearest integer.float a = floor(2.3) // a = 2.0
Arguments
- double v - Argument.
Return value
Largest integer value not greater than arg.float floor(float v)
Rounds an argument down to the nearest integer.double a = floor(2.3) // a = 2.0
Arguments
- float v - Argument.
Return value
Largest integer value not greater than arg.float frac(float v)
Returns the fractional part of the argument.float a = frac(3.141593); // a = 0.141593
Arguments
- float v - Argument.
Return value
Fractional part of the argument.double frac(double v)
Returns the fractional part of the argument.double a = frac(3.141593); // a = 0.141593
Arguments
- double v - Argument.
Return value
Fractional part of the argument.int ftoi(float v)
Converts a float value to an integer value.Arguments
- float v - Float value.
Return value
Integer value.long long ftol(float v)
Converts a float value to a long value.Arguments
- float v - Float value.
Return value
Long value.double itod(int v)
Converts an integer value to a double value.Arguments
- int v - Integer value.
Return value
Double value.float itof(int v)
Converts an integer value to a float value.Arguments
- int v - Integer value.
Return value
Float value.Scalar itos(int v)
Converts an integer value to a scalar value (float or double, depending on the precision).Arguments
- int v - Integer value.
Return value
Scalar value (float or double, depending on the precision).float length(const vec2 & v)
Calculates the length of a given vector.Arguments
- const vec2 & v - Vector.
Return value
Vector length.double length(const dvec2 & v)
Calculates the length of a given vector.Arguments
- const dvec2 & v - Vector.
Return value
Vector length.float length(const vec3 & v)
Calculates the length of a given vector.Arguments
- const vec3 & v - Vector.
Return value
Vector length.double length(const dvec3 & v)
Calculates the length of a given vector.Arguments
- const dvec3 & v - Vector.
Return value
Vector length.float length(const vec4 & v)
Calculates the length of a given vector.Arguments
- const vec4 & v - Vector.
Return value
Vector length.double length(const dvec4 & v)
Calculates the length of a given vector.Arguments
- const dvec4 & v - Vector.
Return value
Vector length.float length2(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).double length2(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).int length2(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).float length2(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).double length2(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).int length2(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).float length2(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).double length2(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).int length2(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).float lerp(float v0, float v1, float k)
Returns the interpolated value according to the following formula: v0 + (v1 - v0) * k.Arguments
- float v0 - First float value.
- float v1 - Second float value.
- float k - Interpolation coefficient.
Return value
Interpolated value.double lerp(double v0, double v1, double k)
Returns the interpolated value according to the following formula: v0 + (v1 - v0) * k.Arguments
- double v0 - First double value.
- double v1 - Second double value.
- double k - Interpolation coefficient.
Return value
Interpolated value.int lerp(int v0, int v1, int k)
Returns the interpolated value according to the following formula: v0 + (v1 - v0) * k.Arguments
- int v0 - First int value.
- int v1 - Second int value.
- int k - Interpolation coefficient.
Return value
Interpolated value.vec2 lerp(const vec2 & v0, const vec2 & v1, float k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const vec2 & v0 - First vector.
- const vec2 & v1 - Second vector.
- float k - Interpolation coefficient.
Return value
Interpolated vector.vec3 lerp(const vec3 & v0, const vec3 & v1, float k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const vec3 & v0 - First vector.
- const vec3 & v1 - Second vector.
- float k - Interpolation coefficient.
Return value
Interpolated vector.vec4 lerp(const vec4 & v0, const vec4 & v1, float k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const vec4 & v0 - First vector.
- const vec4 & v1 - Second vector.
- float k - Interpolation coefficient.
Return value
Interpolated vector.dvec2 lerp(const dvec2 & v0, const dvec2 & v1, double k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const dvec2 & v0 - First vector.
- const dvec2 & v1 - Second vector.
- double k - Interpolation coefficient.
Return value
Interpolated vector.dvec3 lerp(const dvec3 & v0, const dvec3 & v1, double k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const dvec3 & v0 - First vector.
- const dvec3 & v1 - Second vector.
- double k - Interpolation coefficient.
Return value
Interpolated vector.dvec4 lerp(const dvec4 & v0, const dvec4 & v1, double k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const dvec4 & v0 - First vector.
- const dvec4 & v1 - Second vector.
- double k - Interpolation coefficient.
Return value
Interpolated vector.ivec2 lerp(const ivec2 & v0, const ivec2 & v1, int k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const ivec2 & v0 - First vector.
- const ivec2 & v1 - Second vector.
- int k - Interpolation coefficient.
Return value
Interpolated vector.ivec3 lerp(const ivec3 & v0, const ivec3 & v1, int k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const ivec3 & v0 - First vector.
- const ivec3 & v1 - Second vector.
- int k - Interpolation coefficient.
Return value
Interpolated vector.ivec4 lerp(const ivec4 & v0, const ivec4 & v1, int k)
Returns the interpolated vector according to the following formula: v0 + (v1 - v0) * k.Arguments
- const ivec4 & v0 - First vector.
- const ivec4 & v1 - Second vector.
- int k - Interpolation coefficient.
Return value
Interpolated vector.Type lerp(Type v0, Type v1, Type k)
Returns the interpolated value according to the following formula: v0 + (v1 - v0) * k.Arguments
- Type v0 - First value.
- Type v1 - Second value.
- Type k - Interpolation coefficient.
Return value
Interpolated value.float ltof(long long v)
Converts a long value to a float value.Arguments
- long long v - Long value.
Return value
Float value.double ltod(long long v)
Converts a long value to a double value.Arguments
- long long v - Long value.
Return value
Double value.float max(float v0, float v1)
Returns the maximum value.Arguments
- float v0 - First value.
- float v1 - Second value.
Return value
Maximum value.double max(double v0, double v1)
Returns the maximum value.Arguments
- double v0 - First value.
- double v1 - Second value.
Return value
Maximum value.int max(int v0, int v1)
Returns the maximum value.Arguments
- int v0 - First value.
- int v1 - Second value.
Return value
Maximum value.long long max(long long v0, long long v1)
Returns the maximum value.Arguments
- long long v0 - First value.
- long long v1 - Second value.
Return value
Maximum value.vec2 max(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.vec3 max(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.vec4 max(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.dvec2 max(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.dvec3 max(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.dvec4 max(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.ivec2 max(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.ivec3 max(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.ivec4 max(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.bvec4 max(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.Type max(Type v0, Type v1)
Returns the maximum value.Arguments
- Type v0 - First value.
- Type v1 - Second value.
Return value
Maximum value.float min(float v0, float v1)
Returns the minimum value.Arguments
- float v0 - First value.
- float v1 - Second value.
Return value
Minimum value.double min(double v0, double v1)
Returns the minimum value.Arguments
- double v0 - First value.
- double v1 - Second value.
Return value
Minimum value.int min(int v0, int v1)
Returns the minimum value.Arguments
- int v0 - First value.
- int v1 - Second value.
Return value
Minimum value.long long min(long long v0, long long v1)
Returns the minimum value.Arguments
- long long v0 - First value.
- long long v1 - Second value.
Return value
Minimum value.vec2 min(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.vec3 min(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.vec4 min(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.dvec2 min(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.dvec3 min(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.dvec4 min(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.ivec2 min(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.ivec3 min(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.ivec4 min(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.bvec4 min(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.Type min(Type v0, Type v1)
Returns the minimum value.Arguments
- Type v0 - First value.
- Type v1 - Second value.
Return value
Minimum value.int npot(int arg)
Rounds up to the nearest power of two value.Arguments
- int arg - Argument.
Return value
The nearest upper power of 2 number.float rcp(float v)
Returns the reciprocal of the specified argument.Arguments
- float v - Argument.
Return value
Reciprocal of the argument.double rcp(double v)
Returns the reciprocal of the specified argument.Arguments
- double v - Argument.
Return value
Reciprocal of the argument.double round(double v)
Rounds an argument to the nearest integer value.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.
- 3.5 -> 4
- - 3.5 -> - 4
double a = round(2.3) // a = 2.0
double b = round(5.5) // b = 6.0
double c = round(-5.5) // c = -6.0
Arguments
- double v - Argument.
Return value
Nearest integer value to the argument.float round(float v)
Rounds an argument to the nearest integer value.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.
- 3.5 -> 4
- - 3.5 -> - 4
float a = round(2.3) // a = 2.0
float b = round(5.5) // b = 6.0
float c = round(-5.5) // c = -6.0
Arguments
- float v - Argument.
Return value
Nearest integer value to the argument.float saturate(float v)
Clamps the value within the range of 0.0 to 1.0.Arguments
- float v - Argument.
Return value
Argument value clamped within the range of 0.0 to 1.0.double saturate(double v)
Clamps the value within the range of 0.0 to 1.0.Arguments
- double v - Argument.
Return value
Argument value clamped within the range of 0.0 to 1.0.dvec2 saturate(const dvec2 & v)
Clamps the values of vector components within the range of 0.0 to 1.0.Arguments
- const dvec2 & v
vec2 saturate(const vec2 & v)
Clamps the values of vector components within the range of 0.0 to 1.0.Arguments
- const vec2 & v - Vector.
Return value
Vector with components clamped within the range of 0.0 to 1.0.dvec3 saturate(const dvec3 & v)
Clamps the values of vector components within the range of 0.0 to 1.0.Arguments
- const dvec3 & v - Vector.
Return value
Vector with components clamped within the range of 0.0 to 1.0.vec3 saturate(const vec3 & v)
Clamps the values of vector components within the range of 0.0 to 1.0.Arguments
- const vec3 & v - Vector.
Return value
Vector with components clamped within the range of 0.0 to 1.0.dvec4 saturate(const dvec4 & v)
Clamps the values of vector components within the range of 0.0 to 1.0.Arguments
- const dvec4 & v - Vector.
Return value
Vector with components clamped within the range of 0.0 to 1.0.vec4 saturate(const vec4 & v)
Clamps the values of vector components within the range of 0.0 to 1.0.Arguments
- const vec4 & v - Vector.
Return value
Vector with components clamped within the range of 0.0 to 1.0.float sign(float v)
Returns the sign of the argument.Arguments
- float v - Argument.
Return value
Sign of the argument. 1.0 if v >= 0.0 ; -1.0 if v < 0.0.double sign(double v)
Returns the sign of the argument.Arguments
- double v - Argument.
Return value
Sign of the argument. 1.0 if v >= 0.0 ; -1.0 if v < 0.0.int stoi(Scalar v)
Arguments
- Scalar v - Scalar value (float or double, depending on the precision).
Return value
Integer value.Converts a scalar value (float or double, depending on the precision) to an integer value.int udiv(int x, int y)
Performs integer division with rounding up.Arguments
- int x - First argument.
- int y - Second argument.
Return value
The rounded up quotient of two arguments that satisfies the following condition: y * z >= x.int operator==(const ControlsPtr & c0, const ControlsPtr & c1, g0, g1, i0, i1, m0, m1, m0, m1, p0, p1, m0, m1, s0, s1, s0, s1, t0, t1, t0, t1, ui0, ui1, w0, w1, x0, x1)
Checks if two controls are actually the same controls.Arguments
- const ControlsPtr & c0 - The first control.
- const ControlsPtr & c1 - The second control.
Return value
Returns 1 if two values are the same; otherwise, 0.int operator!=(const ControlsPtr & c0, const ControlsPtr & c1, g0, g1, i0, i1, m0, m1, m0, m1, p0, p1, m0, m1, s0, s1, s0, s1, t0, t1, t0, t1, ui0, ui1, w0, w1, x0, x1)
Checks if two controls are not the same controls.Arguments
- const ControlsPtr & c0 - The first control.
- const ControlsPtr & c1 - The second control.
Return value
Returns 1 if two values are not the same; otherwise, 0.int operator==(const vec2 & v0, const vec2 & v1)
Vector equal comparison.Arguments
- const vec2 & v0 - The first vector.
- const vec2 & v1 - The second vector.
int operator!=(const vec2 & v0, const vec2 & v1)
Vector not equal comparison.Arguments
- const vec2 & v0 - The first vector.
- const vec2 & v1 - The second vector.
vec2 operator*(const vec2 & v0, float v1)
Scalar multiplication.Arguments
- const vec2 & v0 - The value of the vector.
- float v1 - The value of the scalar.
Return value
Resulting vector.vec2 operator*(const vec2 & v0, const vec2 & v1)
Vector multiplication.Arguments
- const vec2 & v0 - First vector.
- const vec2 & v1 - Second vector.
Return value
Resulting vector.vec2 operator+(const vec2 & v0, const vec2 & v1)
Vector addition.Arguments
- const vec2 & v0 - First vector.
- const vec2 & v1 - Second vector.
Return value
Resulting vector.vec2 operator-(const vec2 & v0, const vec2 & v1)
Vector subtraction.Arguments
- const vec2 & v0 - First vector.
- const vec2 & v1 - Second vector.
Return value
Resulting vector.int operator==(const vec3 & v0, const vec3 & v1)
Vector equal comparison.Arguments
- const vec3 & v0 - The first vector.
- const vec3 & v1 - The second vector.
int operator!=(const vec3 & v0, const vec3 & v1)
Vector not equal comparison.Arguments
- const vec3 & v0 - The first vector.
- const vec3 & v1 - The second vector.
vec3 operator*(const vec3 & v0, float v1)
Scalar multiplication.Arguments
- const vec3 & v0 - The value of the vector.
- float v1 - The value of the scalar.
Return value
Resulting vector.vec3 operator*(const vec3 & v0, const vec3 & v1)
Vector multiplication.Arguments
- const vec3 & v0 - First vector.
- const vec3 & v1 - Second vector.
Return value
Resulting vector.vec3 operator+(const vec3 & v0, const vec3 & v1)
Vector addition.Arguments
- const vec3 & v0 - First vector.
- const vec3 & v1 - Second vector.
Return value
Resulting vector.vec3 operator-(const vec3 & v0, const vec3 & v1)
Vector subtraction.Arguments
- const vec3 & v0 - First vector.
- const vec3 & v1 - Second vector.
Return value
Resulting vector.int operator==(const vec4 & v0, const vec4 & v1)
Vector equal comparison.Arguments
- const vec4 & v0 - The first vector.
- const vec4 & v1 - The second vector.
int operator!=(const vec4 & v0, const vec4 & v1)
Vector not equal comparison.Arguments
- const vec4 & v0 - The first vector.
- const vec4 & v1 - The second vector.
vec4 operator*(const vec4 & v0, float v1)
Scalar multiplication.Arguments
- const vec4 & v0 - The value of the vector.
- float v1 - The value of the scalar.
Return value
Resulting vector.vec4 operator*(const vec4 & v0, const vec4 & v1)
Vector multiplication.Arguments
- const vec4 & v0 - First vector.
- const vec4 & v1 - Second vector.
Return value
Resulting vector.vec4 operator+(const vec4 & v0, const vec4 & v1)
Vector addition.Arguments
- const vec4 & v0 - First vector.
- const vec4 & v1 - Second vector.
Return value
Resulting vector.vec4 operator-(const vec4 & v0, const vec4 & v1)
Vector subtraction.Arguments
- const vec4 & v0 - First vector.
- const vec4 & v1 - Second vector.
Return value
Resulting vector.int operator==(const dvec2 & v0, const dvec2 & v1)
Vector equal comparison.Arguments
- const dvec2 & v0 - The first vector.
- const dvec2 & v1 - The second vector.
int operator!=(const dvec2 & v0, const dvec2 & v1)
Vector not equal comparison.Arguments
- const dvec2 & v0 - The first vector.
- const dvec2 & v1 - The second vector.
dvec2 operator*(const dvec2 & v0, double v1)
Scalar multiplication.Arguments
- const dvec2 & v0 - The value of the vector.
- double v1 - The value of the scalar.
Return value
Resulting vector.dvec2 operator*(const dvec2 & v0, const dvec2 & v1)
Vector multiplication.Arguments
- const dvec2 & v0 - First vector.
- const dvec2 & v1 - Second vector.
Return value
Resulting vector.dvec2 operator+(const dvec2 & v0, const dvec2 & v1)
Vector addition.Arguments
- const dvec2 & v0 - First vector.
- const dvec2 & v1 - Second vector.
Return value
Resulting vector.dvec2 operator-(const dvec2 & v0, const dvec2 & v1)
Vector subtraction.Arguments
- const dvec2 & v0 - First vector.
- const dvec2 & v1 - Second vector.
Return value
Resulting vector.int operator==(const dvec3 & v0, const dvec3 & v1)
Vector equal comparison.Arguments
- const dvec3 & v0 - The first vector.
- const dvec3 & v1 - The second vector.
int operator!=(const dvec3 & v0, const dvec3 & v1)
Vector not equal comparison.Arguments
- const dvec3 & v0 - The first vector.
- const dvec3 & v1 - The second vector.
dvec3 operator*(const dvec3 & v0, double v1)
Scalar multiplication.Arguments
- const dvec3 & v0 - The value of the vector.
- double v1 - The value of the scalar.
Return value
Resulting vector.dvec3 operator*(const dvec3 & v0, const dvec3 & v1)
Vector multiplication.Arguments
- const dvec3 & v0 - First vector.
- const dvec3 & v1 - Second vector.
Return value
Resulting vector.dvec3 operator+(const dvec3 & v0, const dvec3 & v1)
Vector addition.Arguments
- const dvec3 & v0 - First vector.
- const dvec3 & v1 - Second vector.
Return value
Resulting vector.dvec3 operator-(const dvec3 & v0, const dvec3 & v1)
Vector subtraction.Arguments
- const dvec3 & v0 - First vector.
- const dvec3 & v1 - Second vector.
Return value
Resulting vector.int operator==(const dvec4 & v0, const dvec4 & v1)
Vector equal comparison.Arguments
- const dvec4 & v0 - The first vector.
- const dvec4 & v1 - The second vector.
int operator!=(const dvec4 & v0, const dvec4 & v1)
Vector not equal comparison.Arguments
- const dvec4 & v0 - The first vector.
- const dvec4 & v1 - The second vector.
dvec4 operator*(const dvec4 & v0, double v1)
Scalar multiplication.Arguments
- const dvec4 & v0 - The value of the vector.
- double v1 - The value of the scalar.
Return value
Resulting vector.dvec4 operator*(const dvec4 & v0, const dvec4 & v1)
Vector multiplication.Arguments
- const dvec4 & v0 - First vector.
- const dvec4 & v1 - Second vector.
Return value
Resulting vector.dvec4 operator+(const dvec4 & v0, const dvec4 & v1)
Vector addition.Arguments
- const dvec4 & v0 - First vector.
- const dvec4 & v1 - Second vector.
Return value
Resulting vector.dvec4 operator-(const dvec4 & v0, const dvec4 & v1)
Vector subtraction.Arguments
- const dvec4 & v0 - First vector.
- const dvec4 & v1 - Second vector.
Return value
Resulting vector.int operator==(const ivec2 & v0, const ivec2 & v1)
Vector equal comparison.Arguments
- const ivec2 & v0 - The first vector.
- const ivec2 & v1 - The second vector.
int operator!=(const ivec2 & v0, const ivec2 & v1)
Vector not equal comparison.Arguments
- const ivec2 & v0 - The first vector.
- const ivec2 & v1 - The second vector.
ivec2 operator*(const ivec2 & v0, int v1)
Scalar multiplication.Arguments
- const ivec2 & v0 - The value of the vector.
- int v1 - The value of the scalar.
Return value
Resulting vector.ivec2 operator*(const ivec2 & v0, const ivec2 & v1)
Vector multiplication.Arguments
- const ivec2 & v0 - First vector.
- const ivec2 & v1 - Second vector.
Return value
Resulting vector.ivec2 operator/(const ivec2 & v0, int v1)
Scalar division.Arguments
- const ivec2 & v0 - The value of the vector.
- int v1 - The value of the scalar.
Return value
Resulting vector.ivec2 operator/(const ivec2 & v0, const ivec2 & v1)
Vector division.Arguments
- const ivec2 & v0 - First vector.
- const ivec2 & v1 - Second vector.
Return value
Resulting vector.ivec2 operator+(const ivec2 & v0, const ivec2 & v1)
Vector addition.Arguments
- const ivec2 & v0 - First vector.
- const ivec2 & v1 - Second vector.
Return value
Resulting vector.ivec2 operator-(const ivec2 & v0, const ivec2 & v1)
Vector subtraction.Arguments
- const ivec2 & v0 - First vector.
- const ivec2 & v1 - Second vector.
Return value
Resulting vector.ivec2 operator<<(const ivec2 & v0, int v1)
Left bit shift.Arguments
- const ivec2 & v0 - The value of the vector.
- int v1 - The shift amount.
Return value
Resulting vector.ivec2 operator>>(const ivec2 & v0, int v1)
Right bit shift.Arguments
- const ivec2 & v0 - The value of the vector.
- int v1 - The shift amount.
Return value
Resulting vector.int operator==(const ivec3 & v0, const ivec3 & v1)
Vector equal comparison.Arguments
- const ivec3 & v0 - The first vector.
- const ivec3 & v1 - The second vector.
int operator!=(const ivec3 & v0, const ivec3 & v1)
Vector not equal comparison.Arguments
- const ivec3 & v0 - The first vector.
- const ivec3 & v1 - The second vector.
ivec3 operator*(const ivec3 & v0, int v1)
Scalar multiplication.Arguments
- const ivec3 & v0 - The value of the vector.
- int v1 - The value of the scalar.
Return value
Resulting vector.ivec3 operator*(const ivec3 & v0, const ivec3 & v1)
Vector multiplication.Arguments
- const ivec3 & v0 - First vector.
- const ivec3 & v1 - Second vector.
Return value
Resulting vector.ivec3 operator/(const ivec3 & v0, int v1)
Scalar division.Arguments
- const ivec3 & v0 - The value of the vector.
- int v1 - The value of the scalar.
Return value
Resulting vector.ivec3 operator/(const ivec3 & v0, const ivec3 & v1)
Vector division.Arguments
- const ivec3 & v0 - First vector.
- const ivec3 & v1 - Second vector.
Return value
Resulting vector.ivec3 operator+(const ivec3 & v0, const ivec3 & v1)
Vector addition.Arguments
- const ivec3 & v0 - First vector.
- const ivec3 & v1 - Second vector.
Return value
Resulting vector.ivec3 operator-(const ivec3 & v0, const ivec3 & v1)
Vector subtraction.Arguments
- const ivec3 & v0 - First vector.
- const ivec3 & v1 - Second vector.
Return value
Resulting vector.ivec3 operator<<(const ivec3 & v0, int v1)
Left bit shift.Arguments
- const ivec3 & v0 - The value of the vector.
- int v1 - The shift amount.
Return value
Resulting vector.ivec3 operator>>(const ivec3 & v0, int v1)
Right bit shift.Arguments
- const ivec3 & v0 - The value of the vector.
- int v1 - The shift amount.
Return value
Resulting vector.int operator==(const ivec4 & v0, const ivec4 & v1)
Vector equal comparison.Arguments
- const ivec4 & v0 - The first vector.
- const ivec4 & v1 - The second vector.
int operator!=(const ivec4 & v0, const ivec4 & v1)
Vector not equal comparison.Arguments
- const ivec4 & v0 - The first vector.
- const ivec4 & v1 - The second vector.
ivec4 operator*(const ivec4 & v0, int v1)
Scalar multiplication.Arguments
- const ivec4 & v0 - The value of the vector.
- int v1 - The value of the scalar.
Return value
Resulting vector.ivec4 operator*(const ivec4 & v0, const ivec4 & v1)
Vector multiplication.Arguments
- const ivec4 & v0 - First vector.
- const ivec4 & v1 - Second vector.
Return value
Resulting vector.ivec4 operator/(const ivec4 & v0, int v1)
Scalar division.Arguments
- const ivec4 & v0 - The value of the vector.
- int v1 - The value of the scalar.
Return value
Resulting vector.ivec4 operator/(const ivec4 & v0, const ivec4 & v1)
Vector division.Arguments
- const ivec4 & v0 - First vector.
- const ivec4 & v1 - Second vector.
Return value
Resulting vector.ivec4 operator+(const ivec4 & v0, const ivec4 & v1)
Vector addition.Arguments
- const ivec4 & v0 - First vector.
- const ivec4 & v1 - Second vector.
Return value
Resulting vector.ivec4 operator-(const ivec4 & v0, const ivec4 & v1)
Vector subtraction.Arguments
- const ivec4 & v0 - First vector.
- const ivec4 & v1 - Second vector.
Return value
Resulting vector.ivec4 operator<<(const ivec4 & v0, int v1)
Left bit shift.Arguments
- const ivec4 & v0 - The value of the vector.
- int v1 - The shift amount.
Return value
Resulting vector.ivec4 operator>>(const ivec4 & v0, int v1)
Right bit shift.Arguments
- const ivec4 & v0 - The value of the vector.
- int v1 - The shift amount.
Return value
Resulting vector.int operator==(const bvec4 & v0, const bvec4 & v1)
Vector equal comparison.Arguments
- const bvec4 & v0 - The first vector.
- const bvec4 & v1 - The second vector.
int operator!=(const bvec4 & v0, const bvec4 & v1)
Vector not equal comparison.Arguments
- const bvec4 & v0 - The first vector.
- const bvec4 & v1 - The second vector.
int operator==(const mat4 & m0, const mat4 & m1)
Matrix equal comparison.Arguments
- const mat4 & m0 - The first matrix.
- const mat4 & m1 - The second matrix.
int operator!=(const mat4 & m0, const mat4 & m1)
Matrix not equal comparison.Arguments
- const mat4 & m0 - The first matrix.
- const mat4 & m1 - The second matrix.
mat4 operator*(const mat4 & m, const float v)
Matrix multiplication.Arguments
- const mat4 & m - The value of the matrix.
- const float v - The value of the scalar.
Return value
The resulting matrix.vec3 operator*(const mat4 & m, const vec3 & v)
Vector multiplication.Arguments
- const mat4 & m - The value of the matrix.
- const vec3 & v - The value of the vector.
Return value
Resulting vector.vec3 operator*(const vec3 & v, const mat4 & m)
Vector multiplication.Arguments
- const vec3 & v - The value of the vector.
- const mat4 & m - The value of the matrix.
Return value
Resulting vector.vec4 operator*(const mat4 & m, const vec4 & v)
Vector multiplication.Arguments
- const mat4 & m - The value of the matrix.
- const vec4 & v - The value of the vector.
Return value
Resulting vector.vec4 operator*(const vec4 & v, const mat4 & m)
Vector multiplication.Arguments
- const vec4 & v - The value of the vector.
- const mat4 & m - The value of the matrix.
Return value
Resulting vector.dvec3 operator*(const mat4 & m, const dvec3 & v)
Vector multiplication.Arguments
- const mat4 & m - The value of the matrix.
- const dvec3 & v - The value of the vector.
Return value
Resulting vector.dvec3 operator*(const dvec3 & v, const mat4 & m)
Vector multiplication.Arguments
- const dvec3 & v - The value of the vector.
- const mat4 & m - The value of the matrix.
Return value
Resulting vector.dvec4 operator*(const mat4 & m, const dvec4 & v)
Vector multiplication.Arguments
- const mat4 & m - The value of the matrix.
- const dvec4 & v - The value of the vector.
Return value
Resulting vector.dvec4 operator*(const dvec4 & v, const mat4 & m)
Vector multiplication.Arguments
- const dvec4 & v - The value of the vector.
- const mat4 & m - The value of the matrix.
Return value
Resulting vector.mat4 operator*(const mat4 & m0, const mat4 & m1)
Matrix multiplication.Arguments
- const mat4 & m0 - The value of the first matrix.
- const mat4 & m1 - The value of the second matrix.
Return value
The resulting matrix.mat4 operator+(const mat4 & m0, const mat4 & m1)
Matrix addition.Arguments
- const mat4 & m0 - The value of the first matrix.
- const mat4 & m1 - The value of the second matrix.
Return value
The resulting matrix.mat4 operator-(const mat4 & m0, const mat4 & m1)
Matrix subtraction.Arguments
- const mat4 & m0 - The value of the first matrix.
- const mat4 & m1 - The value of the second matrix.
Return value
The resulting matrix.int operator==(const dmat4 & m0, const dmat4 & m1)
Matrix equal comparison.Arguments
- const dmat4 & m0 - The first matrix.
- const dmat4 & m1 - The second matrix.
int operator!=(const dmat4 & m0, const dmat4 & m1)
Matrix not equal comparison.Arguments
- const dmat4 & m0 - The first matrix.
- const dmat4 & m1 - The second matrix.
dmat4 operator*(const dmat4 & m, const double v)
Matrix multiplication.Arguments
- const dmat4 & m - The value of the matrix.
- const double v - The value of the scalar.
Return value
The resulting matrix.vec3 operator*(const dmat4 & m, const vec3 & v)
Vector multiplication.Arguments
- const dmat4 & m - The value of the matrix.
- const vec3 & v - The value of the vector.
Return value
Resulting vector.vec3 operator*(const vec3 & v, const dmat4 & m)
Vector multiplication.Arguments
- const vec3 & v - The value of the vector.
- const dmat4 & m - The value of the matrix.
Return value
Resulting vector.vec4 operator*(const dmat4 & m, const vec4 & v)
Vector multiplication.Arguments
- const dmat4 & m - The value of the matrix.
- const vec4 & v - The value of the vector.
Return value
Resulting vector.vec4 operator*(const vec4 & v, const dmat4 & m)
Vector multiplication.Arguments
- const vec4 & v - The value of the vector.
- const dmat4 & m - The value of the matrix.
Return value
Resulting vector.dvec3 operator*(const dmat4 & m, const dvec3 & v)
Vector multiplication.Arguments
- const dmat4 & m - The value of the matrix.
- const dvec3 & v - The value of the vector.
Return value
Resulting vector.dvec3 operator*(const dvec3 & v, const dmat4 & m)
Vector multiplication.Arguments
- const dvec3 & v - The value of the vector.
- const dmat4 & m - The value of the matrix.
Return value
Resulting vector.dvec4 operator*(const dmat4 & m, const dvec4 & v)
Vector multiplication.Arguments
- const dmat4 & m - The value of the matrix.
- const dvec4 & v - The value of the vector.
Return value
Resulting vector.dvec4 operator*(const dvec4 & v, const dmat4 & m)
Vector multiplication.Arguments
- const dvec4 & v - The value of the vector.
- const dmat4 & m - The value of the matrix.
Return value
Resulting vector.dmat4 operator*(const dmat4 & m0, const dmat4 & m1)
Matrix multiplication.Arguments
- const dmat4 & m0 - The value of the first matrix.
- const dmat4 & m1 - The value of the second matrix.
Return value
The resulting matrix.dmat4 operator+(const dmat4 & m0, const dmat4 & m1)
Matrix addition.Arguments
- const dmat4 & m0 - The value of the first matrix.
- const dmat4 & m1 - The value of the second matrix.
Return value
The resulting matrix.dmat4 operator-(const dmat4 & m0, const dmat4 & m1)
Matrix subtraction.Arguments
- const dmat4 & m0 - The value of the first matrix.
- const dmat4 & m1 - The value of the second matrix.
Return value
The resulting matrix.int operator==(const quat & q0, const quat & q1)
Quaternion equal comparison.Arguments
- const quat & q0 - The first quaternion.
- const quat & q1 - The second quaternion.
int operator!=(const quat & q0, const quat & q1)
Quaternion not equal comparison.Arguments
- const quat & q0 - The first quaternion.
- const quat & q1 - The second quaternion.
quat operator*(const quat & q, float v)
Quaternion multiplication.Arguments
- const quat & q - The value of the quaternion.
- float v - The value of the scalar.
Return value
The resulting quaternion.vec3 operator*(const quat & q, const vec3 & v)
Quaternion multiplication.Arguments
- const quat & q - The value of the quaternion.
- const vec3 & v - The value of the vector.
Return value
Resulting vector.vec3 operator*(const vec3 & v, const quat & q)
Quaternion multiplication.Arguments
- const vec3 & v - The value of the vector.
- const quat & q - The value of the quaternion.
Return value
Resulting vector.dvec3 operator*(const quat & q, const dvec3 & v)
Quaternion multiplication.Arguments
- const quat & q - The value of the quaternion.
- const dvec3 & v - The value of the vector.
Return value
Resulting vector.dvec3 operator*(const dvec3 & v, const quat & q)
Quaternion multiplication.Arguments
- const dvec3 & v - The value of the vector.
- const quat & q - The value of the quaternion.
Return value
Resulting vector.quat operator*(const quat & q0, const quat & q1)
Quaternion multiplication.Arguments
- const quat & q0 - The value of the first quaternion.
- const quat & q1 - The value of the second quaternion.
Return value
The resulting quaternion.quat operator+(const quat & q0, const quat & q1)
Quaternion addition.Arguments
- const quat & q0 - The value of the first quaternion.
- const quat & q1 - The value of the second quaternion.
Return value
The resulting quaternion.quat operator-(const quat & q0, const quat & q1)
Quaternion subtraction.Arguments
- const quat & q0 - The value of the first quaternion.
- const quat & q1 - The value of the second quaternion.
Return value
The resulting quaternion.quat slerp(const quat & q0, const quat & q1, float k)
Spherical interpolation between two given quaternions.Arguments
- const quat & q0 - The value of the first quaternion.
- const quat & q1 - The value of the second quaternion.
- float k - The current position (from 0 to 1).
Return value
Resulting quaternion.String operator+(const String & s0, const String & s1)
String addition.Arguments
- const String & s0 - The first string.
- const String & s1 - The second string.
String operator+()
String operator+()
int operator==(const String & s0, const String & s1)
String equal comparison.Arguments
- const String & s0 - The first string.
- const String & s1 - The second string.
int operator==()
int operator==()
int operator!=(const String & s0, const String & s1)
String not equal comparison.Arguments
- const String & s0 - The first string.
- const String & s1 - The second string.
int operator!=()
int operator!=()
int operator<(const String & s0, const String & s1)
String less than comparison.Arguments
- const String & s0 - The first string.
- const String & s1 - The second string.
int operator<()
int operator<()
int operator>(const String & s0, const String & s1)
String greater than comparison.Arguments
- const String & s0 - The first string.
- const String & s1 - The second string.
int operator>()
int operator>()
int operator<=(const String & s0, const String & s1)
String less or equal to comparison.Arguments
- const String & s0 - The first string.
- const String & s1 - The second string.
int operator<=()
int operator<=()
int operator>=(const String & s0, const String & s1)
String greater or equal to comparison.Arguments
- const String & s0 - The first string.
- const String & s1 - The second string.
int operator>=()
int operator>=()
int operator==(const TypeInfo & t0, const TypeInfo & t1)
Check if two TypeInfo classes are referenced the same types.Arguments
- const TypeInfo & t0 - The first TypeIndo class.
- const TypeInfo & t1 - The second TypeIndo class.
Return value
Returns 1 if types are the same; otherwise, 0 is returned.int operator!=(const TypeInfo & t0, const TypeInfo & t1)
Check if two TypeInfo classes are not referenced the same types.Arguments
- const TypeInfo & t0 - The first TypeIndo class.
- const TypeInfo & t1 - The second TypeIndo class.
Return value
Returns 1 if types are not the same; otherwise, 0 is returned.Type clamp(Type v, Type v0, Type v1)
Clamps the value.Arguments
- Type v - Value to be clamped.
- Type v0 - Minimum value.
- Type v1 - Maximum value.
Return value
Clamped value.void swap(Type & v0, Type & v1)
Swaps two values.Arguments
- Type & v0 - First value.
- Type & v1 - Second value.
void swap(Type * v0, Type * v1, int size)
Swaps two arrays.Arguments
- Type * v0 - The first array.
- Type * v1 - The second array.
- int size - The array size.
Last update: 2017-12-21
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)