NVIDIA Iray: Math API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::math::Spectrum Class Reference

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

+ Inheritance diagram for mi::math::Spectrum:

Public Types

typedef Spectrum_struct Pod_type
 POD class corresponding to this spectrum. More...
 
typedef Spectrum_struct storage_type
 Storage class used by this spectrum. More...
 
typedef Float32 value_type
 Element type. More...
 
typedef Size size_type
 Size type, unsigned. More...
 
typedef Difference difference_type
 Difference type, signed. More...
 
typedef Float32pointer
 Mutable pointer to element. More...
 
typedef const Float32const_pointer
 Const pointer to element. More...
 
typedef Float32reference
 Mutable reference to element. More...
 
typedef const Float32const_reference
 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_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...
 
const Float32operator[] (Size i) const
 Accesses the i-th spectrum element, 0 <= i < 3. More...
 
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 Size size ()
 Constant size of the spectrum. More...
 
static Size max_size ()
 Constant maximum size of the spectrum. More...
 

Public Attributes

Float32 c [3]
 Three color bands. More...
 

Static Public Attributes

static const Size SIZE = 3
 Constant size of the spectrum. 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>

Member Typedef Documentation

Const pointer to element.

Const reference to element.

Difference type, signed.

POD class corresponding to this spectrum.

Mutable pointer to element.

Mutable reference to element.

Size type, unsigned.

Storage class used by this spectrum.

Element type.

Constructor & Destructor Documentation

mi::math::Spectrum::Spectrum ( )
inline

The default constructor leaves the spectrum elements uninitialized.

mi::math::Spectrum::Spectrum ( const Spectrum_struct s)
inline

Constructor from underlying storage type.

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

Constructor initializes all vector elements to the value s.

mi::math::Spectrum::Spectrum ( Float32  nr,
Float32  ng,
Float32  nb 
)
inline

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

mi::math::Spectrum::Spectrum ( const Vector< Float32, 3 > &  v3)
inlineexplicit

Conversion from Vector<Float32,3>.

mi::math::Spectrum::Spectrum ( const Vector< Float32, 4 > &  v4)
inlineexplicit

Conversion from Vector<Float32,4>.

mi::math::Spectrum::Spectrum ( const Color col)
inlineexplicit

Conversion from Color.

Member Function Documentation

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

Returns the pointer to the first spectrum element.

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

Returns the pointer to the first spectrum element.

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

Returns the past-the-end pointer.

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

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

Returns the past-the-end pointer.

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

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

Returns the i-th spectrum element, 0 <= i < 3.

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

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

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

Returns the intensity of the RGB components, equally weighted.

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

Constant maximum size of the spectrum.

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

Accesses the i-th spectrum element, 0 <= i < 3.

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

Accesses the i-th spectrum element, 0 <= i < 3.

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

Sets the i-th spectrum element to value, 0 <= i < 3.

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

Constant size of the spectrum.

Vector<Float32,3> mi::math::Spectrum::to_vector3 ( ) const
inline

Conversion to Vector<Float32,3>.

Vector<Float32,4> mi::math::Spectrum::to_vector4 ( ) const
inline

Conversion to Vector<Float32,4>.

Member Data Documentation

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

Three color bands.

const Size mi::math::Spectrum::SIZE = 3
static

Constant size of the spectrum.