neuray API Programmer's Manual

mi::math::Spectrum Class Reference

[Spectrum Class]

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>

Public Typedefs

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

Public Constructors

 Spectrum()
The default constructor leaves the spectrum elements uninitialized.
 Spectrum( const Spectrum_struct& s)
Constructor from underlying storage type.
 Spectrum( const Float32 s)
Constructor initializes all vector elements to the value s.
 Spectrum( Float32 nr, Float32 ng, Float32 nb)
Constructor initializes (r,g,b) from (nr,ng,nb).
 Spectrum( const Vector < Float32 , 3 >& v3)
Conversion from Vector<Float32,3>.
 Spectrum( const Vector < Float32 , 4 >& v4)
Conversion from Vector<Float32,4>.
 Spectrum( const Color& col)
Conversion from Color.

Public Member Functions

Float32begin()
Returns the pointer to the first spectrum element.
const Float32begin() const
Returns the pointer to the first spectrum element.
Float32end()
Returns the past-the-end pointer. More...
const Float32end() const
Returns the past-the-end pointer. More...
Float32 get( Size i) const
Returns the i-th spectrum element, 0 <= i < 3.
bool  is_black() const
Returns true if the spectrum is black ignoring the alpha value.
Float32 linear_intensity() const
Returns the intensity of the RGB components, equally weighted.
Spectrumoperator=( const Spectrum& s)
Assignment operator.
const Float32operator[]( Size i) const
Accesses the i-th spectrum element, 0 <= i < 3.
Float32operator[]( Size i)
Accesses the i-th spectrum element, 0 <= i < 3.
void set( Size i, Float32 value)
Sets the i-th spectrum element to value, 0 <= i < 3.
Vector < Float32 , 3 > to_vector3() const
Conversion to Vector<Float32,3>.
Vector < Float32 , 4 > to_vector4() const
Conversion to Vector<Float32,4>.

Static Public Member Functions

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

Static Public Variables

static const Size SIZE = 3
Constant size of the spectrum.

Typedefs

typedef Spectrum_struct mi::​math::​Spectrum::Pod_type

POD class corresponding to this spectrum.

typedef Float32* mi::​math::​Spectrum::const_pointer

Const pointer to element.

typedef Float32& mi::​math::​Spectrum::const_reference

Const reference to element.

typedef Difference mi::​math::​Spectrum::difference_type

Difference type, signed.

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.

typedef Spectrum_struct mi::​math::​Spectrum::storage_type

Storage class used by this spectrum.

typedef Float32 mi::​math::​Spectrum::value_type

Element type.

Constructors

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) [inline, explicit]

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) [inline, explicit]

Conversion from Vector<Float32,3>.

mi::​math::​Spectrum::Spectrum( const Vector < Float32 , 4 >& v4) [inline, explicit]

Conversion from Vector<Float32,4>.

mi::​math::​Spectrum::Spectrum( const Color& col) [inline, explicit]

Conversion from Color.

Member Functions

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() [inline, static]

Constant maximum size of the spectrum.

Spectrum& mi::​math::​Spectrum::operator=( const Spectrum& s) [inline]

Assignment operator.

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() [inline, static]

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>.

Variables

const Size mi::​math::​Spectrum::SIZE = 3 [static]

Constant size of the spectrum.