NVIDIA Iray: Math API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Spectrum Class

Spectrum 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::Spectrum
  Spectrum with floating point elements and operations. More...
 

Functions

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

Detailed Description

Spectrum class with floating point elements and operations.

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

Function Documentation

Spectrum mi::math::abs ( const Spectrum &  c)
inline

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

Spectrum mi::math::acos ( const Spectrum &  c)
inline

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

bool mi::math::all ( const Spectrum &  c)
inline

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

bool mi::math::any ( const Spectrum &  c)
inline

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

Spectrum mi::math::asin ( const Spectrum &  c)
inline

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

Spectrum mi::math::atan ( const Spectrum &  c)
inline

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

Spectrum mi::math::atan2 ( const Spectrum &  c,
const Spectrum &  d 
)
inline

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

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

Spectrum mi::math::ceil ( const Spectrum &  c)
inline

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

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

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

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

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

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

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

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

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

Spectrum mi::math::cos ( const Spectrum &  c)
inline

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

Spectrum mi::math::degrees ( const Spectrum &  c)
inline

Converts elementwise radians in c to degrees.

Spectrum mi::math::elementwise_max ( const Spectrum &  lhs,
const Spectrum &  rhs 
)
inline

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

Spectrum mi::math::elementwise_min ( const Spectrum &  lhs,
const Spectrum &  rhs 
)
inline

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

Spectrum mi::math::exp ( const Spectrum &  c)
inline

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

Spectrum mi::math::exp2 ( const Spectrum &  c)
inline

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

Spectrum mi::math::floor ( const Spectrum &  c)
inline

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

Spectrum mi::math::fmod ( const Spectrum &  a,
const Spectrum &  b 
)
inline

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

The elementwise result has the same sign as a.

Spectrum mi::math::fmod ( const Spectrum &  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.

Spectrum mi::math::frac ( const Spectrum &  c)
inline

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

void mi::math::from_rgbe ( const Uint8  rgbe[4],
Spectrum &  c 
)
inline

Decodes a color from RGBE representation.

void mi::math::from_rgbe ( const Uint32  rgbe,
Spectrum &  c 
)
inline

Decodes a color from RGBE representation.

Spectrum mi::math::gamma_correction ( const Spectrum &  spectrum,
Float32  gamma_factor 
)
inline

Returns a gamma corrected spectrum.

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 spectrum 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
spectrum spectrum to be corrected
gamma_factor gamma factor, must be greater than zero.
bool mi::math::is_approx_equal ( const Spectrum &  lhs,
const Spectrum &  rhs,
Float32  e 
)
inline

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

bool mi::math::isfinite ( const Spectrum &  c)
inline

Indicates whether all components of the spectrum are finite.

bool mi::math::isinfinite ( const Spectrum &  c)
inline

Indicates whether any component of the spectrum is infinite.

bool mi::math::isnan ( const Spectrum &  c)
inline

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

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

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

Parameters
c1 one spectrum
c2 second spectrum
t interpolation parameter in [0,1]
Spectrum mi::math::lerp ( const Spectrum &  c1,
const Spectrum &  c2,
Float32  t 
)
inline

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

Parameters
c1 one spectrum
c2 second spectrum
t interpolation parameter in [0,1]
Spectrum mi::math::log ( const Spectrum &  c)
inline

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

Spectrum mi::math::log10 ( const Spectrum &  c)
inline

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

Spectrum mi::math::log2 ( const Spectrum &  c)
inline

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

Spectrum mi::math::modf ( const Spectrum &  c,
Spectrum &  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.

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

Returns true if lhs is elementwise not equal to rhs.

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

Multiplies rhs elementwise with lhs and returns the new result.

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

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

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

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

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

Multiplies rhs elementwise with lhs and returns the modified lhs.

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

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

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

Adds lhs and rhs elementwise and returns the new result.

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

Adds rhs elementwise to lhs and returns the modified lhs.

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

Subtracts rhs elementwise from lhs and returns the new result.

Spectrum mi::math::operator- ( const Spectrum &  c)
inline

Negates the spectrum c elementwise and returns the new result.

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

Subtracts rhs elementwise from lhs and returns the modified lhs.

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

Divides rhs elementwise by lhs and returns the new result.

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

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

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

Divides lhs elementwise by rhs and returns the modified lhs.

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

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

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

Returns true if lhs is lexicographically less than rhs.

See Also
Definition: Lexicographic order and comparison
bool mi::math::operator<= ( const Spectrum &  lhs,
const Spectrum &  rhs 
)
inline

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

See Also
Definition: Lexicographic order and comparison
bool mi::math::operator== ( const Spectrum &  lhs,
const Spectrum &  rhs 
)
inline

Returns true if lhs is elementwise equal to rhs.

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

Returns true if lhs is lexicographically greater than rhs.

See Also
Definition: Lexicographic order and comparison
bool mi::math::operator>= ( const Spectrum &  lhs,
const Spectrum &  rhs 
)
inline

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

See Also
Definition: Lexicographic order and comparison
Spectrum mi::math::pow ( const Spectrum &  a,
const Spectrum &  b 
)
inline

Returns the spectrum a elementwise to the power of b.

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

Returns the spectrum a elementwise to the power of b.

Spectrum mi::math::radians ( const Spectrum &  c)
inline

Converts elementwise degrees in c to radians.

Spectrum mi::math::round ( const Spectrum &  c)
inline

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

Spectrum mi::math::rsqrt ( const Spectrum &  c)
inline

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

Spectrum mi::math::saturate ( const Spectrum &  c)
inline

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

Spectrum mi::math::sign ( const Spectrum &  c)
inline

Returns the elementwise sign of spectrum c.

Spectrum mi::math::sin ( const Spectrum &  c)
inline

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

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

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

The angles a are specified in radians.

Spectrum mi::math::smoothstep ( const Spectrum &  a,
const Spectrum &  b,
const Spectrum &  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.

Spectrum mi::math::smoothstep ( const Spectrum &  a,
const Spectrum &  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.

Spectrum mi::math::sqrt ( const Spectrum &  c)
inline

Returns the square root of each element of c.

Spectrum mi::math::step ( const Spectrum &  a,
const Spectrum &  c 
)
inline

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

Spectrum mi::math::tan ( const Spectrum &  c)
inline

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

void mi::math::to_rgbe ( const Spectrum &  c,
Uint32 &  rgbe 
)
inline

Encodes a spectrum into RGBE representation.

void mi::math::to_rgbe ( const Spectrum &  c,
Uint8  rgbe[4] 
)
inline

Encodes a spectrum into RGBE representation.