Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::TSpectrum< T, N > Struct Template Reference

Abstract spectral power distribution data type. More...

#include <mitsuba/core/spectrum.h>

Public Types

typedef T Scalar
 

Public Member Functions

 TSpectrum ()
 Create a new spectral power distribution, but don't initialize the contents. More...
 
 TSpectrum (Scalar v)
 Create a new spectral power distribution with all samples set to the given value. More...
 
 TSpectrum (Scalar spec[N])
 Copy a spectral power distribution. More...
 
 TSpectrum (Stream *stream)
 Unserialize a spectral power distribution from a binary data stream. More...
 
template<typename AltScalar >
 TSpectrum (const TSpectrum< AltScalar, N > &v)
 Initialize with a TSpectrum data type based on a alternate representation. More...
 
TSpectrum operator+ (const TSpectrum &spec) const
 Add two spectral power distributions. More...
 
TSpectrumoperator+= (const TSpectrum &spec)
 Add a spectral power distribution to this instance. More...
 
TSpectrum operator- (const TSpectrum &spec) const
 Subtract a spectral power distribution. More...
 
TSpectrumoperator-= (const TSpectrum &spec)
 Subtract a spectral power distribution from this instance. More...
 
TSpectrum operator* (Scalar f) const
 Multiply by a scalar. More...
 
TSpectrumoperator*= (Scalar f)
 Multiply by a scalar. More...
 
TSpectrum operator* (const TSpectrum &spec) const
 Perform a component-wise multiplication by another spectrum. More...
 
TSpectrumoperator*= (const TSpectrum &spec)
 Perform a component-wise multiplication by another spectrum. More...
 
TSpectrumoperator/= (const TSpectrum &spec)
 Perform a component-wise division by another spectrum. More...
 
TSpectrum operator/ (const TSpectrum &spec) const
 Perform a component-wise division by another spectrum. More...
 
TSpectrum operator/ (Scalar f) const
 Divide by a scalar. More...
 
bool operator== (const TSpectrum &spec) const
 Equality test. More...
 
bool operator!= (const TSpectrum &spec) const
 Inequality test. More...
 
TSpectrumoperator/= (Scalar f)
 Divide by a scalar. More...
 
bool isNaN () const
 Check for NaNs. More...
 
bool isValid () const
 Returns whether the spectrum only contains valid (non-NaN, nonnegative) samples. More...
 
void addWeighted (Scalar weight, const TSpectrum &spec)
 Multiply-accumulate operation, adds weight * spec. More...
 
Scalar average () const
 Return the average over all wavelengths. More...
 
TSpectrum abs () const
 Component-wise absolute value. More...
 
TSpectrum sqrt () const
 Component-wise square root. More...
 
TSpectrum safe_sqrt () const
 Component-wise square root. More...
 
TSpectrum log () const
 Component-wise logarithm. More...
 
TSpectrum exp () const
 Component-wise exponentation. More...
 
TSpectrum pow (Scalar f) const
 Component-wise power. More...
 
void clampNegative ()
 Clamp negative values. More...
 
Scalar max () const
 Return the highest-valued spectral sample. More...
 
Scalar min () const
 Return the lowest-valued spectral sample. More...
 
TSpectrum operator- () const
 Negate. More...
 
Scalaroperator[] (int entry)
 Indexing operator. More...
 
Scalar operator[] (int entry) const
 Indexing operator. More...
 
bool isZero () const
 Check if this spectrum is zero at all wavelengths. More...
 
void serialize (Stream *stream) const
 Serialize this spectrum to a stream. More...
 
std::string toString () const
 

Static Public Attributes

static const int dim = N
 Number of dimensions. More...
 

Protected Attributes

Scalar s [N]
 

Friends

TSpectrum operator* (Scalar f, const TSpectrum &spec)
 Multiply by a scalar. More...
 
TSpectrum operator/ (Scalar f, TSpectrum &spec)
 Divide by a scalar. More...
 

Detailed Description

template<typename T, int N>
struct mitsuba::TSpectrum< T, N >

Abstract spectral power distribution data type.

This class defines a vector-like data type that can be used for computations involving radiance. A concrete instantiation for the precision and spectral discretization chosen at compile time is given by the Spectrum data type.

Member Typedef Documentation

template<typename T, int N>
typedef T mitsuba::TSpectrum< T, N >::Scalar

Constructor & Destructor Documentation

template<typename T, int N>
mitsuba::TSpectrum< T, N >::TSpectrum ( )
inline

Create a new spectral power distribution, but don't initialize the contents.

template<typename T, int N>
mitsuba::TSpectrum< T, N >::TSpectrum ( Scalar  v)
inlineexplicit

Create a new spectral power distribution with all samples set to the given value.

template<typename T, int N>
mitsuba::TSpectrum< T, N >::TSpectrum ( Scalar  spec[N])
inlineexplicit

Copy a spectral power distribution.

template<typename T, int N>
mitsuba::TSpectrum< T, N >::TSpectrum ( Stream stream)
inlineexplicit

Unserialize a spectral power distribution from a binary data stream.

template<typename T, int N>
template<typename AltScalar >
mitsuba::TSpectrum< T, N >::TSpectrum ( const TSpectrum< AltScalar, N > &  v)
inlineexplicit

Initialize with a TSpectrum data type based on a alternate representation.

Member Function Documentation

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::abs ( ) const
inline

Component-wise absolute value.

template<typename T, int N>
void mitsuba::TSpectrum< T, N >::addWeighted ( Scalar  weight,
const TSpectrum< T, N > &  spec 
)
inline

Multiply-accumulate operation, adds weight * spec.

template<typename T, int N>
Scalar mitsuba::TSpectrum< T, N >::average ( ) const
inline

Return the average over all wavelengths.

template<typename T, int N>
void mitsuba::TSpectrum< T, N >::clampNegative ( )
inline

Clamp negative values.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::exp ( ) const
inline

Component-wise exponentation.

template<typename T, int N>
bool mitsuba::TSpectrum< T, N >::isNaN ( ) const
inline

Check for NaNs.

template<typename T, int N>
bool mitsuba::TSpectrum< T, N >::isValid ( ) const
inline

Returns whether the spectrum only contains valid (non-NaN, nonnegative) samples.

template<typename T, int N>
bool mitsuba::TSpectrum< T, N >::isZero ( ) const
inline

Check if this spectrum is zero at all wavelengths.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::log ( ) const
inline

Component-wise logarithm.

template<typename T, int N>
Scalar mitsuba::TSpectrum< T, N >::max ( ) const
inline

Return the highest-valued spectral sample.

template<typename T, int N>
Scalar mitsuba::TSpectrum< T, N >::min ( ) const
inline

Return the lowest-valued spectral sample.

template<typename T, int N>
bool mitsuba::TSpectrum< T, N >::operator!= ( const TSpectrum< T, N > &  spec) const
inline

Inequality test.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::operator* ( Scalar  f) const
inline

Multiply by a scalar.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::operator* ( const TSpectrum< T, N > &  spec) const
inline

Perform a component-wise multiplication by another spectrum.

template<typename T, int N>
TSpectrum& mitsuba::TSpectrum< T, N >::operator*= ( Scalar  f)
inline

Multiply by a scalar.

template<typename T, int N>
TSpectrum& mitsuba::TSpectrum< T, N >::operator*= ( const TSpectrum< T, N > &  spec)
inline

Perform a component-wise multiplication by another spectrum.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::operator+ ( const TSpectrum< T, N > &  spec) const
inline

Add two spectral power distributions.

template<typename T, int N>
TSpectrum& mitsuba::TSpectrum< T, N >::operator+= ( const TSpectrum< T, N > &  spec)
inline

Add a spectral power distribution to this instance.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::operator- ( const TSpectrum< T, N > &  spec) const
inline

Subtract a spectral power distribution.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::operator- ( ) const
inline

Negate.

template<typename T, int N>
TSpectrum& mitsuba::TSpectrum< T, N >::operator-= ( const TSpectrum< T, N > &  spec)
inline

Subtract a spectral power distribution from this instance.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::operator/ ( const TSpectrum< T, N > &  spec) const
inline

Perform a component-wise division by another spectrum.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::operator/ ( Scalar  f) const
inline

Divide by a scalar.

template<typename T, int N>
TSpectrum& mitsuba::TSpectrum< T, N >::operator/= ( const TSpectrum< T, N > &  spec)
inline

Perform a component-wise division by another spectrum.

template<typename T, int N>
TSpectrum& mitsuba::TSpectrum< T, N >::operator/= ( Scalar  f)
inline

Divide by a scalar.

template<typename T, int N>
bool mitsuba::TSpectrum< T, N >::operator== ( const TSpectrum< T, N > &  spec) const
inline

Equality test.

template<typename T, int N>
Scalar& mitsuba::TSpectrum< T, N >::operator[] ( int  entry)
inline

Indexing operator.

template<typename T, int N>
Scalar mitsuba::TSpectrum< T, N >::operator[] ( int  entry) const
inline

Indexing operator.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::pow ( Scalar  f) const
inline

Component-wise power.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::safe_sqrt ( ) const
inline

Component-wise square root.

template<typename T, int N>
void mitsuba::TSpectrum< T, N >::serialize ( Stream stream) const
inline

Serialize this spectrum to a stream.

template<typename T, int N>
TSpectrum mitsuba::TSpectrum< T, N >::sqrt ( ) const
inline

Component-wise square root.

template<typename T, int N>
std::string mitsuba::TSpectrum< T, N >::toString ( ) const
inline

Friends And Related Function Documentation

template<typename T, int N>
TSpectrum operator* ( Scalar  f,
const TSpectrum< T, N > &  spec 
)
friend

Multiply by a scalar.

template<typename T, int N>
TSpectrum operator/ ( Scalar  f,
TSpectrum< T, N > &  spec 
)
friend

Divide by a scalar.

Member Data Documentation

template<typename T, int N>
const int mitsuba::TSpectrum< T, N >::dim = N
static

Number of dimensions.

template<typename T, int N>
Scalar mitsuba::TSpectrum< T, N >::s[N]
protected

The documentation for this struct was generated from the following file: