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... | |
Typedefs | |
typedef Spectrum_struct | mi::math::Spectrum::Pod_type |
POD class corresponding to this spectrum. More... | |
typedef Spectrum_struct | mi::math::Spectrum::storage_type |
Storage class used by this spectrum. More... | |
typedef Float32 | mi::math::Spectrum::value_type |
Element type. More... | |
typedef Size | mi::math::Spectrum::size_type |
Size type, unsigned. More... | |
typedef Difference | mi::math::Spectrum::difference_type |
Difference type, signed. More... | |
typedef Float32 * | mi::math::Spectrum::pointer |
Mutable pointer to element. More... | |
typedef const Float32 * | mi::math::Spectrum::const_pointer |
Const pointer to element. More... | |
typedef Float32 & | mi::math::Spectrum::reference |
Mutable reference to element. More... | |
typedef const Float32 & | mi::math::Spectrum::const_reference |
Const reference to element. More... | |
Functions | |
static Size | mi::math::Spectrum::size () |
Constant size of the spectrum. More... | |
static Size | mi::math::Spectrum::max_size () |
Constant maximum size of the spectrum. More... | |
Float32 * | mi::math::Spectrum::begin () |
Returns the pointer to the first spectrum element. More... | |
const Float32 * | mi::math::Spectrum::begin () const |
Returns the pointer to the first spectrum element. More... | |
Float32 * | mi::math::Spectrum::end () |
Returns the past-the-end pointer. More... | |
const Float32 * | mi::math::Spectrum::end () const |
Returns the past-the-end pointer. More... | |
mi::math::Spectrum::Spectrum () | |
The default constructor leaves the spectrum elements uninitialized. More... | |
mi::math::Spectrum::Spectrum (const Spectrum &s)=default | |
Default copy constructor. More... | |
Spectrum & | mi::math::Spectrum::operator= (const Spectrum &s)=default |
Default assignment operator. More... | |
mi::math::Spectrum::Spectrum (const Spectrum_struct &s) | |
Constructor from underlying storage type. More... | |
mi::math::Spectrum::Spectrum (const Float32 s) | |
Constructor initializes all vector elements to the value s . More... | |
mi::math::Spectrum::Spectrum (Float32 nr, Float32 ng, Float32 nb) | |
Constructor initializes (r,g,b) from (nr ,ng ,nb ). More... | |
mi::math::Spectrum::Spectrum (const Vector< Float32, 3 > &v3) | |
Conversion from Vector<Float32,3>. More... | |
mi::math::Spectrum::Spectrum (const Vector< Float32, 4 > &v4) | |
Conversion from Vector<Float32,4>. More... | |
mi::math::Spectrum::Spectrum (const Color &col) | |
Conversion from Color. More... | |
Vector< Float32, 3 > | mi::math::Spectrum::to_vector3 () const |
Conversion to Vector<Float32,3>. More... | |
Vector< Float32, 4 > | mi::math::Spectrum::to_vector4 () const |
Conversion to Vector<Float32,4>. More... | |
MI_HOST_DEVICE_INLINE const Float32 & | mi::math::Spectrum::operator[] (Size i) const |
Accesses the i-th spectrum element, 0 <= i < 3 . More... | |
MI_HOST_DEVICE_INLINE Float32 & | mi::math::Spectrum::operator[] (Size i) |
Accesses the i-th spectrum element, 0 <= i < 3 . More... | |
Float32 | mi::math::Spectrum::get (Size i) const |
Returns the i-th spectrum element, 0 <= i < 3 . More... | |
void | mi::math::Spectrum::set (Size i, Float32 value) |
Sets the i-th spectrum element to value , 0 <= i < 3 . More... | |
bool | mi::math::Spectrum::is_black () const |
Returns true if the spectrum is black ignoring the alpha value. More... | |
Float32 | mi::math::Spectrum::linear_intensity () const |
Returns the intensity of the RGB components, equally weighted. More... | |
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... | |
MI_HOST_DEVICE_INLINE void | mi::math::to_rgbe (const Spectrum &c, Uint32 &rgbe) |
Encodes a spectrum into RGBE representation. More... | |
MI_HOST_DEVICE_INLINE void | mi::math::to_rgbe (const Spectrum &c, Uint8 rgbe[4]) |
Encodes a spectrum into RGBE representation. More... | |
MI_HOST_DEVICE_INLINE void | mi::math::from_rgbe (const Uint8 rgbe[4], Spectrum &c) |
Decodes a color from RGBE representation. More... | |
MI_HOST_DEVICE_INLINE void | mi::math::from_rgbe (const Uint32 rgbe, Spectrum &c) |
Decodes a color from RGBE representation. More... | |
Variables | |
static const Size | mi::math::Spectrum::SIZE = 3 |
Constant size of the spectrum. More... | |
Spectrum class with floating point elements and operations.
#include <mi/math/spectrum.h>
typedef const Float32* mi::math::Spectrum::const_pointer |
Const pointer to element.
typedef const Float32& mi::math::Spectrum::const_reference |
Const reference to element.
Difference type, signed.
POD class corresponding to this spectrum.
typedef Float32* mi::math::Spectrum::pointer |
Mutable pointer to element.
typedef Float32& mi::math::Spectrum::reference |
Mutable reference to element.
typedef Size mi::math::Spectrum::size_type |
Size type, unsigned.
Storage class used by this spectrum.
Element type.
Returns a spectrum with the elementwise absolute values of the spectrum c
.
Returns a spectrum with the elementwise arc cosine of the spectrum c
.
|
inline |
Returns true
if all elements of c
are not equal to zero.
|
inline |
Returns true
if any element of c
is not equal to zero.
Returns a spectrum with the elementwise arc sine of the spectrum c
.
Returns a spectrum with the elementwise arc tangent of the spectrum c
.
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.
|
inline |
Returns the pointer to the first spectrum element.
|
inline |
Returns the pointer to the first spectrum element.
Returns a spectrum with the elementwise smallest integral value that is not less than the element in spectrum c
.
Returns the spectrum c
elementwise clamped to the range [low
, high
].
Returns the spectrum c
elementwise clamped to the range [low
, high
].
Returns the spectrum c
elementwise clamped to the range [low
, high
].
Returns the spectrum c
elementwise clamped to the range [low
, high
].
Returns a spectrum with the elementwise cosine of the spectrum c
.
Converts elementwise radians in c
to degrees.
Returns elementwise max for each element in spectrum lhs
that is less than the corresponding element in spectrum rhs
.
Returns elementwise min for each element in spectrum lhs
that is less than the corresponding element in spectrum rhs
.
|
inline |
|
inline |
Returns a spectrum with elementwise e
to the power of the element in the spectrum c
.
Returns a spectrum with elementwise 2
to the power of the element in the spectrum c
.
Returns a spectrum with the elementwise largest integral value that is not greater than the element in spectrum c
.
Returns elementwise a
modulo b
, in other words, the remainder of a/b.
The elementwise result has the same sign as a
.
Returns elementwise a
modulo b
, in other words, the remainder of a/b.
The elementwise result has the same sign as a
.
Returns a spectrum with the elementwise positive fractional part of the spectrum c
.
Decodes a color from RGBE representation.
Decodes a color from RGBE representation.
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).
spectrum | spectrum to be corrected |
gamma_factor | gamma factor, must be greater than zero. |
Returns the i-th
spectrum element, 0 <= i < 3
.
Compares the two given values elementwise for equality within the given epsilon.
|
inline |
Returns true
if the spectrum is black ignoring the alpha value.
|
inline |
Indicates whether all components of the spectrum are finite.
|
inline |
Indicates whether any component of the spectrum is infinite.
|
inline |
Indicates whether any component of the spectrum is "not a number".
Returns the elementwise linear interpolation between c1
and c2
, i.e., it returns (1-t) * c1 + t * c2
.
c1 | one spectrum |
c2 | second spectrum |
t | interpolation parameter in [0,1] |
Returns the linear interpolation between c1
and c2
, i.e., it returns (1-t) * c1 + t * c2
.
c1 | one spectrum |
c2 | second spectrum |
t | interpolation parameter in [0,1] |
|
inline |
Returns the intensity of the RGB components, equally weighted.
Returns a spectrum with elementwise natural logarithm of the spectrum c
.
Returns a spectrum with elementwise base 10 logarithm of the spectrum c
.
Returns a spectrum with elementwise base 2 logarithm of the spectrum c
.
|
inlinestatic |
Constant maximum size of the spectrum.
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
.
|
inline |
Returns true
if lhs
is elementwise not equal to rhs
.
Multiplies the spectrum c
elementwise with the scalar s
and returns the new result.
Multiplies rhs
elementwise with lhs
and returns the new result.
Multiplies the spectrum c
elementwise with the scalar s
and returns the new result.
Multiplies the spectrum c
elementwise with the scalar s
and returns the modified spectrum c
.
Multiplies rhs
elementwise with lhs
and returns the modified lhs
.
Adds lhs
and rhs
elementwise and returns the new result.
Adds rhs
elementwise to lhs
and returns the modified lhs
.
Negates the spectrum c
elementwise and returns the new result.
Subtracts rhs
elementwise from lhs
and returns the new result.
Subtracts rhs
elementwise from lhs
and returns the modified lhs
.
Divides the spectrum c
elementwise by the scalar s
and returns the new result.
Divides rhs
elementwise by lhs
and returns the new result.
Divides the spectrum c
elementwise by the scalar s
and returns the modified spectrum c
.
Divides lhs
elementwise by rhs
and returns the modified lhs
.
Returns true
if lhs
is lexicographically less than rhs
.
Returns true
if lhs
is lexicographically less than or equal to rhs
.
Returns true
if lhs
is elementwise equal to rhs
.
Returns true
if lhs
is lexicographically greater than rhs
.
Returns true
if lhs
is lexicographically greater than or equal to rhs
.
Accesses the i-th
spectrum element, 0 <= i < 3
.
Accesses the i-th
spectrum element, 0 <= i < 3
.
Returns the spectrum a
elementwise to the power of b
.
Returns the spectrum a
elementwise to the power of b
.
Converts elementwise degrees in c
to radians.
Returns a spectrum with the elements of spectrum c
rounded to nearest integers.
Returns the reciprocal of the square root of each element of c
.
Returns the spectrum c
clamped elementwise to the range [0,1].
Sets the i-th
spectrum element to value
, 0 <= i < 3
.
Returns a spectrum with the elementwise sine of the spectrum c
.
Computes elementwise the sine s
and cosine c
of angles a
simultaneously.
The angles a
are specified in radians.
|
inlinestatic |
Constant size of the spectrum.
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
.
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
.
|
inline |
The default constructor leaves the spectrum elements uninitialized.
|
inlineexplicit |
Conversion from Color.
|
inlineexplicit |
Constructor initializes all vector elements to the value s
.
|
default |
Default copy constructor.
|
inline |
Constructor from underlying storage type.
Conversion from Vector<Float32,3>.
Conversion from Vector<Float32,4>.
Constructor initializes (r,g,b) from (nr
,ng
,nb
).
Returns elementwise 0 if c
is less than a
and 1 otherwise.
Returns a spectrum with the elementwise tangent of the spectrum c
.
Encodes a spectrum into RGBE representation.
Encodes a spectrum into RGBE representation.
Conversion to Vector<Float32,3>.
Conversion to Vector<Float32,4>.
|
static |
Constant size of the spectrum.