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... |
|
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... |
|
void | mi::math::to_rgbe (const Color &color, Uint32 &rgbe) |
Encodes a color into RGBE representation. More... |
|
void | mi::math::to_rgbe (const Color &color, Uint8 rgbe[4]) |
Encodes a color into RGBE representation. More... |
|
void | mi::math::from_rgbe (const Uint8 rgbe[4], Color &color) |
Decodes a color from RGBE representation. More... |
|
void | mi::math::from_rgbe (const Uint32 rgbe, Color &color) |
Decodes a color from RGBE representation. More... |
|
Standard RGBA color class with floating point elements and operations.
#include <mi/math/color.h>
enum mi::math::Clip_mode |
Supported clipping modes.
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]. |
|
inline |
Returns a color with the elementwise absolute values of the color c
.
|
inline |
Returns a color with the elementwise arc cosine of the color 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.
|
inline |
Returns a color with the elementwise arc sine of the color c
.
|
inline |
Returns a color with the elementwise arc tangent of the color c
.
|
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.
|
inline |
Returns a color with the elementwise smallest integral value that is not less than the element in color c
.
|
inline |
Returns the color c
elementwise clamped to the range [low
, high
].
|
inline |
Returns the color c
elementwise clamped to the range [low
, high
].
|
inline |
Returns the color c
elementwise clamped to the range [low
, high
].
|
inline |
Returns the color c
elementwise clamped to the range [low
, high
].
|
inline |
Returns a color with the elementwise cosine of the color c
.
|
inline |
Converts elementwise radians in c
to degrees.
|
inline |
Returns elementwise max for each element in color lhs
that is less than the corresponding element in color rhs
.
|
inline |
Returns elementwise min for each element in color lhs
that is less than the corresponding element in color rhs
.
|
inline |
Returns a color with elementwise e
to the power of the element in the color c
.
|
inline |
Returns a color with elementwise 2
to the power of the element in the color c
.
|
inline |
Returns a color with the elementwise largest integral value that is not greater than the element in color c
.
|
inline |
Returns elementwise a
modulo b
, in other words, the remainder of a/b.
The elementwise result has the same sign as a
.
|
inline |
Returns elementwise a
modulo b
, in other words, the remainder of a/b.
The elementwise result has the same sign as a
.
|
inline |
Returns a color with the elementwise positive fractional part of the color c
.
|
inline |
Decodes a color from RGBE representation.
|
inline |
Decodes a color from RGBE representation.
|
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).
color | color to be corrected |
gamma_factor | gamma factor, must be greater than zero. |
|
inline |
Compares the two given values elementwise for equality within the given epsilon.
|
inline |
Indicates whether all components of the color are finite.
|
inline |
Indicates whether any component of the color is infinite.
|
inline |
Indicates whether any component of the color is "not a number".
|
inline |
Returns the elementwise linear interpolation between c1
and c2
, i.e., it returns (1-t) * c1 + t * c2
.
c1 | one color |
c2 | second color |
t | interpolation parameter in [0,1] |
|
inline |
Returns the linear interpolation between c1
and c2
, i.e., it returns (1-t) * c1 + t * c2
.
c1 | one color |
c2 | second color |
t | interpolation parameter in [0,1] |
|
inline |
Returns a color with elementwise natural logarithm of the color c
.
|
inline |
Returns a color with elementwise base 10 logarithm of the color c
.
|
inline |
Returns a color with elementwise base 2 logarithm of the color c
.
|
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
.
|
inline |
Returns true
if lhs
is elementwise not equal to rhs
.
|
inline |
Multiplies rhs
elementwise with lhs
and returns the new result.
|
inline |
Multiplies the color c
elementwise with the scalar s
and returns the new result.
|
inline |
Multiplies the color c
elementwise with the scalar s
and returns the new result.
|
inline |
Multiplies rhs
elementwise with lhs
and returns the modified lhs
.
|
inline |
Multiplies the color c
elementwise with the scalar s
and returns the modified color c
.
|
inline |
Adds lhs
and rhs
elementwise and returns the new result.
|
inline |
Adds rhs
elementwise to lhs
and returns the modified lhs
.
|
inline |
Subtracts rhs
elementwise from lhs
and returns the new result.
|
inline |
Negates the color c
elementwise and returns the new result.
|
inline |
Subtracts rhs
elementwise from lhs
and returns the modified lhs
.
|
inline |
Divides rhs
elementwise by lhs
and returns the new result.
|
inline |
Divides the color c
elementwise by the scalar s
and returns the new result.
|
inline |
Divides lhs
elementwise by rhs
and returns the modified lhs
.
|
inline |
Divides the color c
elementwise by the scalar s
and returns the modified color c
.
|
inline |
Returns true
if lhs
is lexicographically less than rhs
.
|
inline |
Returns true
if lhs
is lexicographically less than or equal to rhs
.
|
inline |
Returns true
if lhs
is elementwise equal to rhs
.
|
inline |
Returns true
if lhs
is lexicographically greater than rhs
.
|
inline |
Returns true
if lhs
is lexicographically greater than or equal to rhs
.
|
inline |
Returns the color a
elementwise to the power of b
.
|
inline |
Returns the color a
elementwise to the power of b
.
|
inline |
Converts elementwise degrees in c
to radians.
|
inline |
Returns a color with the elements of color c
rounded to nearest integers.
|
inline |
Returns the reciprocal of the square root of each element of c
.
|
inline |
Returns the color c
clamped elementwise to the range [0,1].
|
inline |
Returns the elementwise sign of color c
.
|
inline |
Returns a color with the elementwise sine of the color c
.
|
inline |
Computes elementwise the sine s
and cosine c
of angles a
simultaneously.
The angles a
are specified in radians.
|
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
.
|
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
.
|
inline |
Returns the square root of each element of c
.
|
inline |
Returns elementwise 0 if c
is less than a
and 1 otherwise.
|
inline |
Returns a color with the elementwise tangent of the color c
.
|
inline |
Encodes a color into RGBE representation.
|
inline |
Encodes a color into RGBE representation.