The math API provides functions and function templates that act on simple types or generic container and vector concepts.
More...
|
Float32 |
mi::math::exp (Float32 s) |
|
Returns the constant e to the power of s (exponential function). More...
|
|
Float64 |
mi::math::exp (Float64 s) |
|
Returns the constant e to the power of s (exponential function). More...
|
|
Float32 |
mi::math::log (Float32 s) |
|
Returns the natural logarithm of s . More...
|
|
Float64 |
mi::math::log (Float64 s) |
|
Returns the natural logarithm of s . More...
|
|
Float32 |
mi::math::acos (Float32 s) |
|
Returns the arc cosine of s in radians. More...
|
|
Float64 |
mi::math::acos (Float64 s) |
|
Returns the arc cosine of s in radians. More...
|
|
bool |
mi::math::all (Uint8 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Uint16 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Uint32 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Uint64 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Sint8 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Sint16 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Sint32 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Sint64 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Float32 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::all (Float64 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Uint8 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Uint16 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Uint32 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Uint64 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Sint8 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Sint16 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Sint32 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Sint64 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Float32 v) |
|
Returns true if v is not equal to zero. More...
|
|
bool |
mi::math::any (Float64 v) |
|
Returns true if v is not equal to zero. More...
|
|
Float32 |
mi::math::asin (Float32 s) |
|
Returns the arc sine of s in radians. More...
|
|
Float64 |
mi::math::asin (Float64 s) |
|
Returns the arc sine of s in radians. More...
|
|
Float32 |
mi::math::atan (Float32 s) |
|
Returns the arc tangent of s . More...
|
|
Float64 |
mi::math::atan (Float64 s) |
|
Returns the arc tangent of s . More...
|
|
Float32 |
mi::math::atan2 (Float32 s, Float32 t) |
|
Returns the arc tangent of s / t . More...
|
|
Float64 |
mi::math::atan2 (Float64 s, Float64 t) |
|
Returns the arc tangent of s / t . More...
|
|
Float32 |
mi::math::ceil (Float32 s) |
|
Returns the smallest integral value that is not less than s . More...
|
|
Float64 |
mi::math::ceil (Float64 s) |
|
Returns the smallest integral value that is not less than s . More...
|
|
Uint8 |
mi::math::clamp (Uint8 s, Uint8 low, Uint8 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Uint16 |
mi::math::clamp (Uint16 s, Uint16 low, Uint16 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Uint32 |
mi::math::clamp (Uint32 s, Uint32 low, Uint32 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Uint64 |
mi::math::clamp (Uint64 s, Uint64 low, Uint64 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Sint8 |
mi::math::clamp (Sint8 s, Sint8 low, Sint8 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Sint16 |
mi::math::clamp (Sint16 s, Sint16 low, Sint16 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Sint32 |
mi::math::clamp (Sint32 s, Sint32 low, Sint32 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Sint64 |
mi::math::clamp (Sint64 s, Sint64 low, Sint64 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Float32 |
mi::math::clamp (Float32 s, Float32 low, Float32 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Float64 |
mi::math::clamp (Float64 s, Float64 low, Float64 high) |
|
Returns the value s if it is in the range [low , high ], the value low if s < low , or the value high if s > high . More...
|
|
Float32 |
mi::math::cos (Float32 a) |
|
Returns the cosine of a . The angle a is specified in radians. More...
|
|
Float64 |
mi::math::cos (Float64 a) |
|
Returns the cosine of a . The angle a is specified in radians. More...
|
|
Float32 |
mi::math::degrees (Float32 r) |
|
Converts radians r to degrees. More...
|
|
Float64 |
mi::math::degrees (Float64 r) |
|
Converts radians r to degrees. More...
|
|
Float32 |
mi::math::exp2 (Float32 s) |
|
Returns the constant 2 to the power of s (exponential function). More...
|
|
Float64 |
mi::math::exp2 (Float64 s) |
|
Returns the constant 2 to the power of s (exponential function). More...
|
|
Float32 |
mi::math::floor (Float32 s) |
|
Returns the largest integral value that is not greater than s . More...
|
|
Float64 |
mi::math::floor (Float64 s) |
|
Returns the largest integral value that is not greater than s . More...
|
|
Float32 |
mi::math::fmod (Float32 a, Float32 b) |
|
Returns a modulo b , in other words, the remainder of a/b. More...
|
|
Float64 |
mi::math::fmod (Float64 a, Float64 b) |
|
Returns a modulo b , in other words, the remainder of a/b. More...
|
|
Float32 |
mi::math::frac (Float32 s) |
|
Returns the positive fractional part of s . More...
|
|
Float64 |
mi::math::frac (Float64 s) |
|
Returns the positive fractional part of s . More...
|
|
bool |
mi::math::is_approx_equal (Float32 left, Float32 right, Float32 e) |
|
Compares the two given values for equality within the given epsilon. More...
|
|
bool |
mi::math::is_approx_equal (Float64 left, Float64 right, Float64 e) |
|
Compares the two given values for equality within the given epsilon. More...
|
|
Float32 |
mi::math::log2 (Float32 s) |
|
Returns the base 2 logarithm of s . More...
|
|
Float64 |
mi::math::log2 (Float64 s) |
|
Returns the base 2 logarithm of s . More...
|
|
Float32 |
mi::math::log10 (Float32 s) |
|
Returns the base 10 logarithm of s . More...
|
|
Float64 |
mi::math::log10 (Float64 s) |
|
Returns the base 10 logarithm of s . More...
|
|
Float32 |
mi::math::lerp (Float32 s1, Float32 s2, Float32 t) |
|
Returns the linear interpolation between s1 and s2 , i.e., it returns (1-t) * s1 + t * s2 . More...
|
|
Float64 |
mi::math::lerp (Float64 s1, Float64 s2, Float64 t) |
|
Returns the linear interpolation between s1 and s2 , i.e., it returns (1-t) * s1 + t * s2 . More...
|
|
Float32 |
mi::math::modf (Float32 s, Float32 &i) |
|
Returns the fractional part of s and stores the integral part of s in i . More...
|
|
Float64 |
mi::math::modf (Float64 s, Float64 &i) |
|
Returns the fractional part of s and stores the integral part of s in i . More...
|
|
Uint32 |
mi::math::pow (Uint32 a, Uint32 b) |
|
Returns a to the power of b . More...
|
|
Uint64 |
mi::math::pow (Uint64 a, Uint64 b) |
|
Returns a to the power of b . More...
|
|
Sint32 |
mi::math::pow (Sint32 a, Sint32 b) |
|
Returns a to the power of b . More...
|
|
Sint64 |
mi::math::pow (Sint64 a, Sint64 b) |
|
Returns a to the power of b . More...
|
|
Float32 |
mi::math::pow (Float32 a, Float32 b) |
|
Returns a to the power of b . More...
|
|
Float64 |
mi::math::pow (Float64 a, Float64 b) |
|
Returns a to the power of b . More...
|
|
Float32 |
mi::math::radians (Float32 d) |
|
Converts degrees d to radians. More...
|
|
Float64 |
mi::math::radians (Float64 d) |
|
Converts degrees d to radians. More...
|
|
Float32 |
mi::math::round (Float32 s) |
|
Returns s rounded to the nearest integer value. More...
|
|
Float64 |
mi::math::round (Float64 s) |
|
Returns s rounded to the nearest integer value. More...
|
|
Float32 |
mi::math::rsqrt (Float32 s) |
|
Returns the reciprocal of the square root of s . More...
|
|
Float64 |
mi::math::rsqrt (Float64 s) |
|
Returns the reciprocal of the square root of s . More...
|
|
Float32 |
mi::math::saturate (Float32 s) |
|
Returns the value s clamped to the range [0,1]. More...
|
|
Float64 |
mi::math::saturate (Float64 s) |
|
Returns the value s clamped to the range [0,1]. More...
|
|
Sint8 |
mi::math::sign (Sint8 s) |
|
Returns -1 if s<0 , 0 if s==0 , and +1 if s>0 . More...
|
|
Sint16 |
mi::math::sign (Sint16 s) |
|
Returns -1 if s<0 , 0 if s==0 , and +1 if s>0 . More...
|
|
Sint32 |
mi::math::sign (Sint32 s) |
|
Returns -1 if s<0 , 0 if s==0 , and +1 if s>0 . More...
|
|
Sint64 |
mi::math::sign (Sint64 s) |
|
Returns -1 if s<0 , 0 if s==0 , and +1 if s>0 . More...
|
|
Float32 |
mi::math::sign (Float32 s) |
|
Returns -1 if s<0 , 0 if s==0 , and +1 if s>0 . More...
|
|
Float64 |
mi::math::sign (Float64 s) |
|
Returns -1 if s<0 , 0 if s==0 , and +1 if s>0 . More...
|
|
bool |
mi::math::sign_bit (Sint8 s) |
|
Returns true if s<0 and false if s>= 0. More...
|
|
bool |
mi::math::sign_bit (Sint16 s) |
|
Returns true if s<0 and false if s>= 0. More...
|
|
bool |
mi::math::sign_bit (Sint32 s) |
|
Returns true if s<0 and false if s>= 0. More...
|
|
bool |
mi::math::sign_bit (Sint64 s) |
|
Returns true if s<0 and false if s>= 0. More...
|
|
bool |
mi::math::sign_bit (Float32 s) |
|
Extracts the sign bit of a single-precision floating point number. More...
|
|
bool |
mi::math::sign_bit (Float64 s) |
|
Extracts the sign bit of a double-precision floating point number. More...
|
|
bool |
mi::math::isnan (const Float32 x) |
|
Checks a single-precision floating point number for "not a number". More...
|
|
bool |
mi::math::isnan (const Float64 x) |
|
Checks a double-precision floating point number for "not a number". More...
|
|
bool |
mi::math::isinfinite (const Float32 x) |
|
Checks a single-precision floating point number for "infinity". More...
|
|
bool |
mi::math::isinfinite (const Float64 x) |
|
Checks a double-precision floating point number for "infinity". More...
|
|
bool |
mi::math::isfinite (const Float32 x) |
|
Checks a single-precision floating point number for neither "not a number" nor "infinity". More...
|
|
bool |
mi::math::isfinite (const Float64 x) |
|
Checks a double-precision floating point number for neither "not a number" nor "infinity". More...
|
|
Float32 |
mi::math::sin (Float32 a) |
|
Returns the sine of a . The angle a is specified in radians. More...
|
|
Float64 |
mi::math::sin (Float64 a) |
|
Returns the sine of a . The angle a is specified in radians. More...
|
|
void |
mi::math::sincos (Float32 a, Float32 &s, Float32 &c) |
|
Computes the sine s and cosine c of angle a simultaneously. More...
|
|
void |
mi::math::sincos (Float64 a, Float64 &s, Float64 &c) |
|
Computes the sine s and cosine c of angle a simultaneously. More...
|
|
Float32 |
mi::math::smoothstep (Float32 a, Float32 b, Float32 x) |
|
Returns 0 if x is less than a and 1 if x is greater than b . More...
|
|
Float64 |
mi::math::smoothstep (Float64 a, Float64 b, Float64 x) |
|
Returns 0 if x is less than a and 1 if x is greater than b . More...
|
|
Float32 |
mi::math::sqrt (Float32 s) |
|
Returns the square root of s . More...
|
|
Float64 |
mi::math::sqrt (Float64 s) |
|
Returns the square root of s . More...
|
|
Float32 |
mi::math::step (Float32 a, Float32 x) |
|
Returns 0 if x is less than a and 1 otherwise. More...
|
|
Float64 |
mi::math::step (Float64 a, Float64 x) |
|
Returns 0 if x is less than a and 1 otherwise. More...
|
|
Float32 |
mi::math::tan (Float32 a) |
|
Returns the tangent of a . The angle a is specified in radians. More...
|
|
Float64 |
mi::math::tan (Float64 a) |
|
Returns the tangent of a . The angle a is specified in radians. More...
|
|
void |
mi::math::to_rgbe (const Float32 color[3], Uint32 &rgbe) |
|
Encodes a color into RGBE representation. More...
|
|
void |
mi::math::to_rgbe (const Float32 color[3], Uint8 rgbe[4]) |
|
Encodes a color into RGBE representation. More...
|
|
void |
mi::math::from_rgbe (const Uint8 rgbe[4], Float32 color[3]) |
|
Decodes a color from RGBE representation. More...
|
|
void |
mi::math::from_rgbe (const Uint32 rgbe, Float32 color[3]) |
|
Decodes a color from RGBE representation. More...
|
|
Sint32 |
mi::math::dot (Sint32 a, Sint32 b) |
|
Returns the inner product (a.k.a. dot or scalar product) of two integers. More...
|
|
Float32 |
mi::math::dot (Float32 a, Float32 b) |
|
Returns the inner product (a.k.a. dot or scalar product) of two scalars. More...
|
|
Float64 |
mi::math::dot (Float64 a, Float64 b) |
|
Returns the inner product (a.k.a. dot or scalar product) of two scalars. More...
|
|
template<class V > |
V::value_type |
mi::math::dot (const V &lhs, const V &rhs) |
|
Returns the inner product (a.k.a. dot or scalar product) of two vectors. More...
|
|
template<class V > |
V::value_type |
mi::math::square_length (const V &v) |
|
Returns the squared Euclidean norm of the vector v . More...
|
|
Float32 |
mi::math::length (Float32 a) |
|
Returns the Euclidean norm of the scalar a (its absolute value). More...
|
|
Float64 |
mi::math::length (Float64 a) |
|
Returns the Euclidean norm of the scalar a (its absolute value). More...
|
|
template<class V > |
V::value_type |
mi::math::length (const V &v) |
|
Returns the Euclidean norm of the vector v . More...
|
|
template<class V > |
V::value_type |
mi::math::square_euclidean_distance (const V &lhs, const V &rhs) |
|
Returns the squared Euclidean distance from the vector lhs to the vector rhs . More...
|
|
template<class V > |
V::value_type |
mi::math::euclidean_distance (const V &lhs, const V &rhs) |
|
Returns the Euclidean distance from the vector lhs to the vector rhs . More...
|
|
template<class V > |
void |
mi::math::set_bounds (V &v, const V &low, const V &high) |
|
Bounds the value of vector v elementwise to the given low and high vector values. More...
|
|
template<class V > |
bool |
mi::math::is_equal (const V &lhs, const V &rhs) |
|
Returns true if vector lhs is elementwise equal to vector rhs , and false otherwise. More...
|
|
template<class V > |
Comparison_result |
mi::math::lexicographically_compare (const V &lhs, const V &rhs) |
|
Compares two vectors lexicographically. More...
|
|
template<class V > |
bool |
mi::math::lexicographically_less (const V &lhs, const V &rhs) |
|
Returns true if vector lhs is lexicographically less than vector rhs , and false otherwise. More...
|
|
The math API provides functions and function templates that act on simple types or generic container and vector concepts.
Functions exist typically as a family of overloaded functions for all applicable argument types, such as trigonometric functions, or as a single function template for a vector-like concept, such as lexicographically_compare().
Generic function templates on vector-like value require the vector-like type to have a compile-time constant SIZE
as local value, defining the number of elements in the value, and operator
[] style access to these elements.
Overloaded functions may have additional overloads for various non-simple types, such as mi::math::Vector or mi::math::Color.
Functions in this group are intended for unqualified naming, such that argument-dependent name lookup (ADL, a.k.a. extended Koenig lookup) can be used with them.