Iray SDK API nvidia_logo_transpbg.gif Up
color.h File Reference

Standard RGBA color class with floating point elements and operations. More...

Go to the source code of this file.

Classes

struct  mi::math::Spectrum_struct
 Generic storage class template for a Spectrum representation storing three floating point elements. More...
 
class  mi::math::Color
 Standard RGBA color class with floating point elements and operations. More...
 

Namespaces

namespace  mi
 Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
 
namespace  mi::math
 Namespace for the Math API.
 

Enumerations

enum  mi::math::Clip_mode {
  mi::math::CLIP_RGB ,
  mi::math::CLIP_ALPHA ,
  mi::math::CLIP_RAW
}
 Supported clipping modes. More...
 

Functions

bool mi::math::operator== (const Color &lhs, const Color &rhs)
 Returns true if lhs is elementwise equal to rhs. More...
 
bool mi::math::operator!= (const Color &lhs, const Color &rhs)
 Returns true if lhs is elementwise not equal to rhs. More...
 
bool mi::math::operator< (const Color &lhs, const Color &rhs)
 Returns true if lhs is lexicographically less than rhs. More...
 
bool mi::math::operator<= (const Color &lhs, const Color &rhs)
 Returns true if lhs is lexicographically less than or equal to rhs. More...
 
bool mi::math::operator> (const Color &lhs, const Color &rhs)
 Returns true if lhs is lexicographically greater than rhs. More...
 
bool mi::math::operator>= (const Color &lhs, const Color &rhs)
 Returns true if lhs is lexicographically greater than or equal to rhs. More...
 
Color & mi::math::operator+= (Color &lhs, const Color &rhs)
 Adds rhs elementwise to lhs and returns the modified lhs. More...
 
Color & mi::math::operator-= (Color &lhs, const Color &rhs)
 Subtracts rhs elementwise from lhs and returns the modified lhs. More...
 
Color & mi::math::operator*= (Color &lhs, const Color &rhs)
 Multiplies rhs elementwise with lhs and returns the modified lhs. More...
 
Color & mi::math::operator/= (Color &lhs, const Color &rhs)
 Divides lhs elementwise by rhs and returns the modified lhs. More...
 
Color mi::math::operator+ (const Color &lhs, const Color &rhs)
 Adds lhs and rhs elementwise and returns the new result. More...
 
Color mi::math::operator- (const Color &lhs, const Color &rhs)
 Subtracts rhs elementwise from lhs and returns the new result. More...
 
Color mi::math::operator* (const Color &lhs, const Color &rhs)
 Multiplies rhs elementwise with lhs and returns the new result. More...
 
Color mi::math::operator/ (const Color &lhs, const Color &rhs)
 Divides rhs elementwise by lhs and returns the new result. More...
 
Color mi::math::operator- (const Color &c)
 Negates the color c elementwise and returns the new result. More...
 
Color & mi::math::operator*= (Color &c, Float32 s)
 Multiplies the color c elementwise with the scalar s and returns the modified color c. More...
 
Color & mi::math::operator/= (Color &c, Float32 s)
 Divides the color c elementwise by the scalar s and returns the modified color c. More...
 
Color mi::math::operator* (const Color &c, Float32 s)
 Multiplies the color c elementwise with the scalar s and returns the new result. More...
 
Color mi::math::operator* (Float32 s, const Color &c)
 Multiplies the color c elementwise with the scalar s and returns the new result. More...
 
Color mi::math::operator/ (const Color &c, Float32 s)
 Divides the color c elementwise by the scalar s and returns the new result. More...
 
Color mi::math::abs (const Color &c)
 Returns a color with the elementwise absolute values of the color c. More...
 
Color mi::math::acos (const Color &c)
 Returns a color with the elementwise arc cosine of the color c. More...
 
bool mi::math::all (const Color &c)
 Returns true if all elements of c are not equal to zero. More...
 
bool mi::math::any (const Color &c)
 Returns true if any element of c is not equal to zero. More...
 
Color mi::math::asin (const Color &c)
 Returns a color with the elementwise arc sine of the color c. More...
 
Color mi::math::atan (const Color &c)
 Returns a color with the elementwise arc tangent of the color c. More...
 
Color mi::math::atan2 (const Color &c, const Color &d)
 Returns a color with the elementwise arc tangent of the color c / d. More...
 
Color mi::math::ceil (const Color &c)
 Returns a color with the elementwise smallest integral value that is not less than the element in color c. More...
 
Color mi::math::clamp (const Color &c, const Color &low, const Color &high)
 Returns the color c elementwise clamped to the range [low, high]. More...
 
Color mi::math::clamp (const Color &c, const Color &low, Float32 high)
 Returns the color c elementwise clamped to the range [low, high]. More...
 
Color mi::math::clamp (const Color &c, Float32 low, const Color &high)
 Returns the color c elementwise clamped to the range [low, high]. More...
 
Color mi::math::clamp (const Color &c, Float32 low, Float32 high)
 Returns the color c elementwise clamped to the range [low, high]. More...
 
Color mi::math::cos (const Color &c)
 Returns a color with the elementwise cosine of the color c. More...
 
Color mi::math::degrees (const Color &c)
 Converts elementwise radians in c to degrees. More...
 
Color mi::math::elementwise_max (const Color &lhs, const Color &rhs)
 Returns elementwise max for each element in color lhs that is less than the corresponding element in color rhs. More...
 
Color mi::math::elementwise_min (const Color &lhs, const Color &rhs)
 Returns elementwise min for each element in color lhs that is less than the corresponding element in color rhs. More...
 
Color mi::math::exp (const Color &c)
 Returns a color with elementwise e to the power of the element in the color c. More...
 
Color mi::math::exp2 (const Color &c)
 Returns a color with elementwise 2 to the power of the element in the color c. More...
 
Color mi::math::floor (const Color &c)
 Returns a color with the elementwise largest integral value that is not greater than the element in color c. More...
 
Color mi::math::fmod (const Color &a, const Color &b)
 Returns elementwise a modulo b, in other words, the remainder of a/b. More...
 
Color mi::math::fmod (const Color &a, Float32 b)
 Returns elementwise a modulo b, in other words, the remainder of a/b. More...
 
Color mi::math::frac (const Color &c)
 Returns a color with the elementwise positive fractional part of the color c. More...
 
Color mi::math::gamma_correction (const Color &color, Float32 gamma_factor)
 Returns a gamma corrected color. More...
 
bool mi::math::is_approx_equal (const Color &lhs, const Color &rhs, Float32 e)
 Compares the two given values elementwise for equality within the given epsilon. More...
 
Color mi::math::lerp (const Color &c1, const Color &c2, const Color &t)
 Returns the elementwise linear interpolation between c1 and c2, i.e., it returns (1-t) * c1 + t * c2. More...
 
Color mi::math::lerp (const Color &c1, const Color &c2, Float32 t)
 Returns the linear interpolation between c1 and c2, i.e., it returns (1-t) * c1 + t * c2. More...
 
Color mi::math::log (const Color &c)
 Returns a color with elementwise natural logarithm of the color c. More...
 
Color mi::math::log2 (const Color &c)
 Returns a color with elementwise base 2 logarithm of the color c. More...
 
Color mi::math::log10 (const Color &c)
 Returns a color with elementwise base 10 logarithm of the color c. More...
 
Color mi::math::modf (const Color &c, Color &i)
 Returns the elementwise fractional part of c and stores the elementwise integral part of c in i. More...
 
Color mi::math::pow (const Color &a, const Color &b)
 Returns the color a elementwise to the power of b. More...
 
Color mi::math::pow (const Color &a, Float32 b)
 Returns the color a elementwise to the power of b. More...
 
Color mi::math::radians (const Color &c)
 Converts elementwise degrees in c to radians. More...
 
Color mi::math::round (const Color &c)
 Returns a color with the elements of color c rounded to nearest integers. More...
 
Color mi::math::rsqrt (const Color &c)
 Returns the reciprocal of the square root of each element of c. More...
 
Color mi::math::saturate (const Color &c)
 Returns the color c clamped elementwise to the range [0,1]. More...
 
Color mi::math::sign (const Color &c)
 Returns the elementwise sign of color c. More...
 
Color mi::math::sin (const Color &c)
 Returns a color with the elementwise sine of the color c. More...
 
void mi::math::sincos (const Color &a, Color &s, Color &c)
 Computes elementwise the sine s and cosine c of angles a simultaneously. More...
 
Color mi::math::smoothstep (const Color &a, const Color &b, const Color &c)
 Returns 0 if c is less than a and 1 if c is greater than b in an elementwise fashion. More...
 
Color mi::math::smoothstep (const Color &a, const Color &b, Float32 x)
 Returns 0 if c is less than a and 1 if c is greater than b in an elementwise fashion. More...
 
Color mi::math::sqrt (const Color &c)
 Returns the square root of each element of c. More...
 
Color mi::math::step (const Color &a, const Color &c)
 Returns elementwise 0 if c is less than a and 1 otherwise. More...
 
Color mi::math::tan (const Color &c)
 Returns a color with the elementwise tangent of the color c. More...
 
bool mi::math::isfinite (const Color &c)
 Indicates whether all components of the color are finite. More...
 
bool mi::math::isinfinite (const Color &c)
 Indicates whether any component of the color is infinite. More...
 
bool mi::math::isnan (const Color &c)
 Indicates whether any component of the color is "not a number". More...
 
MI_HOST_DEVICE_INLINE void mi::math::to_rgbe (const Color &color, Uint32 &rgbe)
 Encodes a color into RGBE representation. More...
 
MI_HOST_DEVICE_INLINE void mi::math::to_rgbe (const Color &color, Uint8 rgbe[4])
 Encodes a color into RGBE representation. More...
 
MI_HOST_DEVICE_INLINE void mi::math::from_rgbe (const Uint8 rgbe[4], Color &color)
 Decodes a color from RGBE representation. More...
 
MI_HOST_DEVICE_INLINE void mi::math::from_rgbe (const Uint32 rgbe, Color &color)
 Decodes a color from RGBE representation. More...
 

Detailed Description

Standard RGBA color class with floating point elements and operations.

See Color Class.