MDL SDK API nvidia_logo_transpbg.gif Up
mi::math::Spectrum Class Reference

Spectrum with floating point elements and operations. More...

#include <spectrum.h>

Inheritance diagram for mi::math::Spectrum:

Public Types

using Pod_type = Spectrum_struct
 POD class corresponding to this spectrum. More...
 
using storage_type = Spectrum_struct
 Storage class used by this spectrum. More...
 
using value_type = Float32
 Element type. More...
 
using size_type = Size
 Size type, unsigned. More...
 
using difference_type = Difference
 Difference type, signed. More...
 
using pointer = Float32 *
 Mutable pointer to element. More...
 
using const_pointer = const Float32 *
 Const pointer to element. More...
 
using reference = Float32 &
 Mutable reference to element. More...
 
using const_reference = const Float32 &
 Const reference to element. More...
 

Public Member Functions

Float32begin ()
 Returns the pointer to the first spectrum element. More...
 
const Float32begin () const
 Returns the pointer to the first spectrum element. More...
 
Float32end ()
 Returns the past-the-end pointer. More...
 
const Float32end () const
 Returns the past-the-end pointer. More...
 
 Spectrum ()
 The default constructor leaves the spectrum elements uninitialized. More...
 
 Spectrum (const Spectrum &s)=default
 Default copy constructor. More...
 
Spectrumoperator= (const Spectrum &s)=default
 Default assignment operator. More...
 
 Spectrum (const Spectrum_struct &s)
 Constructor from underlying storage type. More...
 
 Spectrum (const Float32 s)
 Constructor initializes all vector elements to the value s. More...
 
 Spectrum (Float32 nr, Float32 ng, Float32 nb)
 Constructor initializes (r,g,b) from (nr,ng,nb). More...
 
 Spectrum (const Vector< Float32, 3 > &v3)
 Conversion from Vector<Float32,3>. More...
 
 Spectrum (const Vector< Float32, 4 > &v4)
 Conversion from Vector<Float32,4>. More...
 
 Spectrum (const Color &col)
 Conversion from Color. More...
 
Vector< Float32, 3 > to_vector3 () const
 Conversion to Vector<Float32,3>. More...
 
Vector< Float32, 4 > to_vector4 () const
 Conversion to Vector<Float32,4>. More...
 
MI_HOST_DEVICE_INLINE const Float32operator[] (Size i) const
 Accesses the i-th spectrum element, 0 <= i < 3. More...
 
MI_HOST_DEVICE_INLINE Float32operator[] (Size i)
 Accesses the i-th spectrum element, 0 <= i < 3. More...
 
Float32 get (Size i) const
 Returns the i-th spectrum element, 0 <= i < 3. More...
 
void set (Size i, Float32 value)
 Sets the i-th spectrum element to value, 0 <= i < 3. More...
 
bool is_black () const
 Returns true if the spectrum is black ignoring the alpha value. More...
 
Float32 linear_intensity () const
 Returns the intensity of the RGB components, equally weighted. More...
 

Static Public Member Functions

static constexpr Size size ()
 Constant size of the spectrum. More...
 
static constexpr Size max_size ()
 Constant maximum size of the spectrum. More...
 

Static Public Attributes

static constexpr Size SIZE = 3
 Constant size of the spectrum. More...
 

Additional Inherited Members

- Public Attributes inherited from mi::math::Spectrum_struct
Float32 c [3]
 Three color bands. More...
 

Detailed Description

Spectrum with floating point elements and operations.

Note
This class will most likely change in the future, since currently it uses only three components. Therefore it behaves almost identical to the Color class, apart from the missing alpha component. Future implementations will probably contain a lot more bands or might have a completely different internal structure.

The spectrum class is a model of the STL container concept. It provides random access to its elements and corresponding random access iterators.

See also
For the free functions and operators available for spectra see Spectrum Class.
Include File:
#include <mi/math/spectrum.h>