Iray SDK API nvidia_logo_transpbg.gif Up
Color Class

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

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...
 
struct  mi::math::Color_struct
 Generic storage class template for an RGBA color representation storing four floating points elements. More...
 

Typedefs

typedef Color_struct mi::math::Color::Pod_type
 POD class corresponding to this color. More...
 
typedef Color_struct mi::math::Color::storage_type
 Storage class used by this color. More...
 
typedef Float32 mi::math::Color::value_type
 Element type. More...
 
typedef Size mi::math::Color::size_type
 Size type, unsigned. More...
 
typedef Difference mi::math::Color::difference_type
 Difference type, signed. More...
 
typedef Float32mi::math::Color::pointer
 Mutable pointer to element. More...
 
typedef const Float32mi::math::Color::const_pointer
 Const pointer to element. More...
 
typedef Float32mi::math::Color::reference
 Mutable reference to element. More...
 
typedef const Float32mi::math::Color::const_reference
 Const reference to element. More...
 

Enumerations

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

Functions

static Size mi::math::Color::size ()
 Constant size of the color. More...
 
static Size mi::math::Color::max_size ()
 Constant maximum size of the color. More...
 
Float32mi::math::Color::begin ()
 Returns the pointer to the first color element. More...
 
const Float32mi::math::Color::begin () const
 Returns the pointer to the first color element. More...
 
Float32mi::math::Color::end ()
 Returns the past-the-end pointer. More...
 
const Float32mi::math::Color::end () const
 Returns the past-the-end pointer. More...
 
 mi::math::Color::Color ()
 The default constructor leaves the color elements uninitialized. More...
 
 mi::math::Color::Color (const Color &c)=default
 Default copy constructor. More...
 
 mi::math::Color::Color (const Color_struct &c)
 Constructor from underlying storage type. More...
 
 mi::math::Color::Color (const Float32 s)
 Constructor initializes all vector elements to the value s. More...
 
 mi::math::Color::Color (Float32 nr, Float32 ng, Float32 nb, Float32 na=1.0)
 Constructor initializes (r,g,b,a) from (nr,ng,nb,na). More...
 
template<typename T>
 mi::math::Color::Color (T array[4])
 Constructor initializes the color elements from a 4-dimensional array. More...
 
 mi::math::Color::Color (const Vector< Float32, 4 > &v)
 Constructor initializes (r,g,b,a) from (v.x, v.y, v.z, v.w) of a compatible 4D vector v. More...
 
 mi::math::Color::Color (const Spectrum_struct &s)
 Conversion from Spectrum. More...
 
Colormi::math::Color::operator= (const Color &c)
 Assignment operator. More...
 
Colormi::math::Color::operator= (const Vector< Float32, 4 > &v)
 Assignment operator from compatible 4D vector, setting (r,g,b,a) to (v.x, v.y, v.z, v.w). More...
 
const Float32mi::math::Color::operator[] (Size i) const
 Accesses the i-th color element, 0 <= i < 4. More...
 
Float32mi::math::Color::operator[] (Size i)
 Accesses the i-th color element, 0 <= i < 4. More...
 
Float32 mi::math::Color::get (Size i) const
 Returns the i-th color element, 0 <= i < 4. More...
 
void mi::math::Color::set (Size i, Float32 value)
 Sets the i-th color element to value, 0 <= i < 4. More...
 
bool mi::math::Color::is_black () const
 Returns true if the color is black ignoring the alpha value. More...
 
Float32 mi::math::Color::linear_intensity () const
 Returns the intensity of the RGB components, equally weighted. More...
 
Float32 mi::math::Color::ntsc_intensity () const
 Returns the intensity of the RGB components, weighted according to the NTSC standard. More...
 
Float32 mi::math::Color::cie_intensity () const
 Returns the intensity of the RGB components, weighted according to the CIE standard. More...
 
Color mi::math::Color::clip (Clip_mode mode=CLIP_RGB, bool desaturate=false) const
 Returns this color clipped into the [0,1] range, according to the Clip_mode mode, and fades overbright colors to white if desaturate is true. More...
 
Color mi::math::Color::desaturate (Float32 maxval=1.0f) const
 Returns this color clipped to the range [0,maxval] using color desaturation. More...
 
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...
 
Colormi::math::operator+= (Color &lhs, const Color &rhs)
 Adds rhs elementwise to lhs and returns the modified lhs. More...
 
Colormi::math::operator-= (Color &lhs, const Color &rhs)
 Subtracts rhs elementwise from lhs and returns the modified lhs. More...
 
Colormi::math::operator*= (Color &lhs, const Color &rhs)
 Multiplies rhs elementwise with lhs and returns the modified lhs. More...
 
Colormi::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...
 
Colormi::math::operator*= (Color &c, Float32 s)
 Multiplies the color c elementwise with the scalar s and returns the modified color c. More...
 
Colormi::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...
 

Variables

Float32 mi::math::Spectrum_struct::c [3]
 Three color bands. More...
 
static const Size mi::math::Color::SIZE = 4
 Constant size of the color. More...
 

Detailed Description

Standard RGBA color class with floating point elements and operations.

Include File:
#include <mi/math/color.h>

Typedef Documentation

 const_pointer

Const pointer to element.

 const_reference

Const reference to element.

 difference_type

Difference type, signed.

 Pod_type

POD class corresponding to this color.

 pointer

Mutable pointer to element.

 reference

Mutable reference to element.

 size_type

Size type, unsigned.

 storage_type

Storage class used by this color.

 value_type

Element type.

Enumeration Type Documentation

 Clip_mode

Supported clipping modes.

See also
mi::Color::clip() function.
Enumerator
CLIP_RGB 

First clip RGB to [0,1], then clip A to [max(R,G,B),1].

CLIP_ALPHA 

First clip A to [0,1], then clip RGB to [0,A].

CLIP_RAW 

Clip RGB and A to [0,1].

Function Documentation

 abs()

Color mi::math::abs ( const Color c)
inline

Returns a color with the elementwise absolute values of the color c.

 acos()

Color mi::math::acos ( const Color c)
inline

Returns a color with the elementwise arc cosine of the color c.

 all()

bool mi::math::all ( const Color c)
inline

Returns true if all elements of c are not equal to zero.

 any()

bool mi::math::any ( const Color c)
inline

Returns true if any element of c is not equal to zero.

 asin()

Color mi::math::asin ( const Color c)
inline

Returns a color with the elementwise arc sine of the color c.

 atan()

Color mi::math::atan ( const Color c)
inline

Returns a color with the elementwise arc tangent of the color c.

 atan2()

Color mi::math::atan2 ( const Color c,
const Color d 
)
inline

Returns a color with the elementwise arc tangent of the color c / d.

The signs of the elements of c and d are used to determine the quadrant of the results.

 begin() [1/2]

Float32 * mi::math::Color::begin ( )
inline

Returns the pointer to the first color element.

 begin() [2/2]

const Float32 * mi::math::Color::begin ( ) const
inline

Returns the pointer to the first color element.

 ceil()

Color mi::math::ceil ( const Color c)
inline

Returns a color with the elementwise smallest integral value that is not less than the element in color c.

 cie_intensity()

Float32 mi::math::Color::cie_intensity ( ) const
inline

Returns the intensity of the RGB components, weighted according to the CIE standard.

Components are weighted to match the subjective color brightness perceived by the human eye; green appears brighter than blue.

 clamp() [1/4]

Color mi::math::clamp ( const Color c,
const Color low,
const Color high 
)
inline

Returns the color c elementwise clamped to the range [low, high].

 clamp() [2/4]

Color mi::math::clamp ( const Color c,
const Color low,
Float32  high 
)
inline

Returns the color c elementwise clamped to the range [low, high].

 clamp() [3/4]

Color mi::math::clamp ( const Color c,
Float32  low,
const Color high 
)
inline

Returns the color c elementwise clamped to the range [low, high].

 clamp() [4/4]

Color mi::math::clamp ( const Color c,
Float32  low,
Float32  high 
)
inline

Returns the color c elementwise clamped to the range [low, high].

 clip()

Color mi::math::Color::clip ( Clip_mode  mode = CLIP_RGB,
bool  desaturate = false 
) const
inline

Returns this color clipped into the [0,1] range, according to the Clip_mode mode, and fades overbright colors to white if desaturate is true.

 Color() [1/8]

mi::math::Color::Color ( )
inline

The default constructor leaves the color elements uninitialized.

 Color() [2/8]

mi::math::Color::Color ( const Color c)
default

Default copy constructor.

 Color() [3/8]

mi::math::Color::Color ( const Color_struct c)
inline

Constructor from underlying storage type.

 Color() [4/8]

mi::math::Color::Color ( const Float32  s)
inlineexplicit

Constructor initializes all vector elements to the value s.

 Color() [5/8]

mi::math::Color::Color ( const Spectrum_struct s)
inlineexplicit

Conversion from Spectrum.

 Color() [6/8]

mi::math::Color::Color ( const Vector< Float32, 4 > &  v)
inlineexplicit

Constructor initializes (r,g,b,a) from (v.x, v.y, v.z, v.w) of a compatible 4D vector v.

 Color() [7/8]

mi::math::Color::Color ( Float32  nr,
Float32  ng,
Float32  nb,
Float32  na = 1.0 
)
inline

Constructor initializes (r,g,b,a) from (nr,ng,nb,na).

 Color() [8/8]

template<typename T>
mi::math::Color::Color ( array[4])
inlineexplicit

Constructor initializes the color elements from a 4-dimensional array.

The value type T of the array must be assignment compatible with the mi::Float32 type of the vector elements.

An example defining a red color:

int data[4] = { 1, 0, 0, 1};
mi::math::Color color( data);
Standard RGBA color class with floating point elements and operations.
Definition: color.h:81

 cos()

Color mi::math::cos ( const Color c)
inline

Returns a color with the elementwise cosine of the color c.

 degrees()

Color mi::math::degrees ( const Color c)
inline

Converts elementwise radians in c to degrees.

 desaturate()

Color mi::math::Color::desaturate ( Float32  maxval = 1.0f) const
inline

Returns this color clipped to the range [0,maxval] using color desaturation.

This function tries to maintain the apparent brightness. It recognizes the brightness values of the different colors according to the NTSC standard. If possible, colors are adjusted by desaturating towards the brightness value.

For an explanation of color clipping using desaturation, see pp. 125-128 and pp. 251-252 of "Illumination and Color in Computer Generated Imagery" by Roy Hall.

 elementwise_max()

Color mi::math::elementwise_max ( const Color lhs,
const Color rhs 
)
inline

Returns elementwise max for each element in color lhs that is less than the corresponding element in color rhs.

 elementwise_min()

Color mi::math::elementwise_min ( const Color lhs,
const Color rhs 
)
inline

Returns elementwise min for each element in color lhs that is less than the corresponding element in color rhs.

 end() [1/2]

Float32 * mi::math::Color::end ( )
inline

Returns the past-the-end pointer.

The range [begin(),end()) forms the range over all color elements.

 end() [2/2]

const Float32 * mi::math::Color::end ( ) const
inline

Returns the past-the-end pointer.

The range [begin(),end()) forms the range over all color elements.

 exp()

Color mi::math::exp ( const Color c)
inline

Returns a color with elementwise e to the power of the element in the color c.

 exp2()

Color mi::math::exp2 ( const Color c)
inline

Returns a color with elementwise 2 to the power of the element in the color c.

 floor()

Color mi::math::floor ( const Color c)
inline

Returns a color with the elementwise largest integral value that is not greater than the element in color c.

 fmod() [1/2]

Color mi::math::fmod ( const Color a,
const Color b 
)
inline

Returns elementwise a modulo b, in other words, the remainder of a/b.

The elementwise result has the same sign as a.

 fmod() [2/2]

Color mi::math::fmod ( const Color a,
Float32  b 
)
inline

Returns elementwise a modulo b, in other words, the remainder of a/b.

The elementwise result has the same sign as a.

 frac()

Color mi::math::frac ( const Color c)
inline

Returns a color with the elementwise positive fractional part of the color c.

 from_rgbe() [1/2]

MI_HOST_DEVICE_INLINE void mi::math::from_rgbe ( const Uint32  rgbe,
Color color 
)

Decodes a color from RGBE representation.

Note
The alpha value is set to 1.0.

 from_rgbe() [2/2]

MI_HOST_DEVICE_INLINE void mi::math::from_rgbe ( const Uint8  rgbe[4],
Color color 
)

Decodes a color from RGBE representation.

Note
The alpha value is set to 1.0.

 gamma_correction()

Color mi::math::gamma_correction ( const Color color,
Float32  gamma_factor 
)
inline

Returns a gamma corrected color.

Gamma factors are used to correct for non-linear input and output devices; for example, monitors typically have gamma factors between 1.7 and 2.2, meaning that one-half of the peak voltage does not give one half of the brightness. This is corrected for by raising the color components to the gamma exponent. Gamma factors greater than 1 make an image brighter; less than 1 make it darker. The inverse of gamma_correction(factor) is gamma_correction(1.0/factor).

Parameters
colorcolor to be corrected
gamma_factorgamma factor, must be greater than zero.

 get()

Float32 mi::math::Color::get ( Size  i) const
inline

Returns the i-th color element, 0 <= i < 4.

 is_approx_equal()

bool mi::math::is_approx_equal ( const Color lhs,
const Color rhs,
Float32  e 
)
inline

Compares the two given values elementwise for equality within the given epsilon.

 is_black()

bool mi::math::Color::is_black ( ) const
inline

Returns true if the color is black ignoring the alpha value.

 isfinite()

bool mi::math::isfinite ( const Color c)
inline

Indicates whether all components of the color are finite.

 isinfinite()

bool mi::math::isinfinite ( const Color c)
inline

Indicates whether any component of the color is infinite.

 isnan()

bool mi::math::isnan ( const Color c)
inline

Indicates whether any component of the color is "not a number".

 lerp() [1/2]

Color mi::math::lerp ( const Color c1,
const Color c2,
const Color t 
)
inline

Returns the elementwise linear interpolation between c1 and c2, i.e., it returns (1-t) * c1 + t * c2.

Parameters
c1one color
c2second color
tinterpolation parameter in [0,1]

 lerp() [2/2]

Color mi::math::lerp ( const Color c1,
const Color c2,
Float32  t 
)
inline

Returns the linear interpolation between c1 and c2, i.e., it returns (1-t) * c1 + t * c2.

Parameters
c1one color
c2second color
tinterpolation parameter in [0,1]

 linear_intensity()

Float32 mi::math::Color::linear_intensity ( ) const
inline

Returns the intensity of the RGB components, equally weighted.

 log()

Color mi::math::log ( const Color c)
inline

Returns a color with elementwise natural logarithm of the color c.

 log10()

Color mi::math::log10 ( const Color c)
inline

Returns a color with elementwise base 10 logarithm of the color c.

 log2()

Color mi::math::log2 ( const Color c)
inline

Returns a color with elementwise base 2 logarithm of the color c.

 max_size()

static Size mi::math::Color::max_size ( )
inlinestatic

Constant maximum size of the color.

 modf()

Color mi::math::modf ( const Color c,
Color i 
)
inline

Returns the elementwise fractional part of c and stores the elementwise integral part of c in i.

Both parts have elementwise the same sign as c.

 ntsc_intensity()

Float32 mi::math::Color::ntsc_intensity ( ) const
inline

Returns the intensity of the RGB components, weighted according to the NTSC standard.

Components are weighted to match the subjective color brightness perceived by the human eye; green appears brighter than blue.

 operator!=()

bool mi::math::operator!= ( const Color lhs,
const Color rhs 
)
inline

Returns true if lhs is elementwise not equal to rhs.

 operator*() [1/3]

Color mi::math::operator* ( const Color c,
Float32  s 
)
inline

Multiplies the color c elementwise with the scalar s and returns the new result.

 operator*() [2/3]

Color mi::math::operator* ( const Color lhs,
const Color rhs 
)
inline

Multiplies rhs elementwise with lhs and returns the new result.

 operator*() [3/3]

Color mi::math::operator* ( Float32  s,
const Color c 
)
inline

Multiplies the color c elementwise with the scalar s and returns the new result.

 operator*=() [1/2]

Color & mi::math::operator*= ( Color c,
Float32  s 
)
inline

Multiplies the color c elementwise with the scalar s and returns the modified color c.

 operator*=() [2/2]

Color & mi::math::operator*= ( Color lhs,
const Color rhs 
)
inline

Multiplies rhs elementwise with lhs and returns the modified lhs.

 operator+()

Color mi::math::operator+ ( const Color lhs,
const Color rhs 
)
inline

Adds lhs and rhs elementwise and returns the new result.

 operator+=()

Color & mi::math::operator+= ( Color lhs,
const Color rhs 
)
inline

Adds rhs elementwise to lhs and returns the modified lhs.

 operator-() [1/2]

Color mi::math::operator- ( const Color c)
inline

Negates the color c elementwise and returns the new result.

 operator-() [2/2]

Color mi::math::operator- ( const Color lhs,
const Color rhs 
)
inline

Subtracts rhs elementwise from lhs and returns the new result.

 operator-=()

Color & mi::math::operator-= ( Color lhs,
const Color rhs 
)
inline

Subtracts rhs elementwise from lhs and returns the modified lhs.

 operator/() [1/2]

Color mi::math::operator/ ( const Color c,
Float32  s 
)
inline

Divides the color c elementwise by the scalar s and returns the new result.

 operator/() [2/2]

Color mi::math::operator/ ( const Color lhs,
const Color rhs 
)
inline

Divides rhs elementwise by lhs and returns the new result.

 operator/=() [1/2]

Color & mi::math::operator/= ( Color c,
Float32  s 
)
inline

Divides the color c elementwise by the scalar s and returns the modified color c.

 operator/=() [2/2]

Color & mi::math::operator/= ( Color lhs,
const Color rhs 
)
inline

Divides lhs elementwise by rhs and returns the modified lhs.

 operator<()

bool mi::math::operator< ( const Color lhs,
const Color rhs 
)
inline

Returns true if lhs is lexicographically less than rhs.

See also
Definition: Lexicographic order and comparison

 operator<=()

bool mi::math::operator<= ( const Color lhs,
const Color rhs 
)
inline

Returns true if lhs is lexicographically less than or equal to rhs.

See also
Definition: Lexicographic order and comparison

 operator=() [1/2]

Color & mi::math::Color::operator= ( const Color c)
inline

Assignment operator.

 operator=() [2/2]

Color & mi::math::Color::operator= ( const Vector< Float32, 4 > &  v)
inline

Assignment operator from compatible 4D vector, setting (r,g,b,a) to (v.x, v.y, v.z, v.w).

 operator==()

bool mi::math::operator== ( const Color lhs,
const Color rhs 
)
inline

Returns true if lhs is elementwise equal to rhs.

 operator>()

bool mi::math::operator> ( const Color lhs,
const Color rhs 
)
inline

Returns true if lhs is lexicographically greater than rhs.

See also
Definition: Lexicographic order and comparison

 operator>=()

bool mi::math::operator>= ( const Color lhs,
const Color rhs 
)
inline

Returns true if lhs is lexicographically greater than or equal to rhs.

See also
Definition: Lexicographic order and comparison

 operator[]() [1/2]

Float32 & mi::math::Color::operator[] ( Size  i)
inline

Accesses the i-th color element, 0 <= i < 4.

 operator[]() [2/2]

const Float32 & mi::math::Color::operator[] ( Size  i) const
inline

Accesses the i-th color element, 0 <= i < 4.

 pow() [1/2]

Color mi::math::pow ( const Color a,
const Color b 
)
inline

Returns the color a elementwise to the power of b.

 pow() [2/2]

Color mi::math::pow ( const Color a,
Float32  b 
)
inline

Returns the color a elementwise to the power of b.

 radians()

Color mi::math::radians ( const Color c)
inline

Converts elementwise degrees in c to radians.

 round()

Color mi::math::round ( const Color c)
inline

Returns a color with the elements of color c rounded to nearest integers.

 rsqrt()

Color mi::math::rsqrt ( const Color c)
inline

Returns the reciprocal of the square root of each element of c.

 saturate()

Color mi::math::saturate ( const Color c)
inline

Returns the color c clamped elementwise to the range [0,1].

 set()

void mi::math::Color::set ( Size  i,
Float32  value 
)
inline

Sets the i-th color element to value, 0 <= i < 4.

 sign()

Color mi::math::sign ( const Color c)
inline

Returns the elementwise sign of color c.

 sin()

Color mi::math::sin ( const Color c)
inline

Returns a color with the elementwise sine of the color c.

 sincos()

void mi::math::sincos ( const Color a,
Color s,
Color c 
)
inline

Computes elementwise the sine s and cosine c of angles a simultaneously.

The angles a are specified in radians.

 size()

static Size mi::math::Color::size ( )
inlinestatic

Constant size of the color.

 smoothstep() [1/2]

Color mi::math::smoothstep ( const Color a,
const Color b,
const Color c 
)
inline

Returns 0 if c is less than a and 1 if c is greater than b in an elementwise fashion.

A smooth curve is applied in-between so that the return values vary continuously from 0 to 1 as elements in c vary from a to b.

 smoothstep() [2/2]

Color mi::math::smoothstep ( const Color a,
const Color b,
Float32  x 
)
inline

Returns 0 if c is less than a and 1 if c is greater than b in an elementwise fashion.

A smooth curve is applied in-between so that the return values vary continuously from 0 to 1 as x varies from a to b.

 sqrt()

Color mi::math::sqrt ( const Color c)
inline

Returns the square root of each element of c.

 step()

Color mi::math::step ( const Color a,
const Color c 
)
inline

Returns elementwise 0 if c is less than a and 1 otherwise.

 tan()

Color mi::math::tan ( const Color c)
inline

Returns a color with the elementwise tangent of the color c.

 to_rgbe() [1/2]

MI_HOST_DEVICE_INLINE void mi::math::to_rgbe ( const Color color,
Uint32 rgbe 
)

Encodes a color into RGBE representation.

Note
The alpha value is not part of the RGBE representation.

 to_rgbe() [2/2]

MI_HOST_DEVICE_INLINE void mi::math::to_rgbe ( const Color color,
Uint8  rgbe[4] 
)

Encodes a color into RGBE representation.

Note
The alpha value is not part of the RGBE representation.

Variable Documentation

 c

Float32 mi::math::Spectrum_struct::c[3]

Three color bands.

 SIZE

const Size mi::math::Color::SIZE = 4
static

Constant size of the color.