Linearly interpolated spectral power distribution. More...
#include <mitsuba/core/spectrum.h>
Public Member Functions | |
InterpolatedSpectrum (size_t size=0) | |
Create a new interpolated spectrum with space for the specified number of samples. More... | |
InterpolatedSpectrum (const Float *wavelengths, const Float *values, size_t nEntries) | |
Create a interpolated spectrum instance from a float array. More... | |
InterpolatedSpectrum (const fs::path &path) | |
Read an interpolated spectrum from a simple ASCII format. More... | |
void | append (Float lambda, Float value) |
Append an entry to the spectral power distribution. More... | |
void | zeroExtend () |
This function adds a zero entry before and after the stored wavelength range. More... | |
void | clear () |
Clear all stored entries. More... | |
Float | eval (Float lambda) const |
Return the value of the spectral power distribution at the given wavelength. More... | |
Float | average (Float lambdaMin, Float lambdaMax) const |
Integrate the spectral power distribution over a given interval and return the average value. More... | |
std::string | toString () const |
Return a string representation. More... | |
virtual | ~InterpolatedSpectrum () |
Virtual destructor. More... | |
Public Member Functions inherited from mitsuba::ContinuousSpectrum | |
virtual | ~ContinuousSpectrum () |
Virtual destructor. More... | |
Protected Attributes | |
std::vector< Float > | m_wavelengths |
std::vector< Float > | m_values |
Linearly interpolated spectral power distribution.
This class implements a linearly interpolated spectral power distribution that is defined over a discrete set of measurements at different wavelengths. Outside of the specified range, the spectrum is assumed to be zero. Hence, at least two entries are required to produce a nonzero spectrum.
mitsuba::InterpolatedSpectrum::InterpolatedSpectrum | ( | size_t | size = 0 | ) |
Create a new interpolated spectrum with space for the specified number of samples.
mitsuba::InterpolatedSpectrum::InterpolatedSpectrum | ( | const Float * | wavelengths, |
const Float * | values, | ||
size_t | nEntries | ||
) |
Create a interpolated spectrum instance from a float array.
mitsuba::InterpolatedSpectrum::InterpolatedSpectrum | ( | const fs::path & | path | ) |
Read an interpolated spectrum from a simple ASCII format.
Each line of the file should contain an entry of the form
* <wavelength in nm> <value> *
Comments preceded by '#' are also valid.
|
inlinevirtual |
Virtual destructor.
Append an entry to the spectral power distribution.
Entries must be added in order of increasing wavelength
Integrate the spectral power distribution over a given interval and return the average value.
This method overrides the implementation in ContinousSpectrum, since the integral can be analytically computed for linearly interpolated spectra.
lambdaMin | The lower interval bound in nanometers |
lambdaMax | The upper interval bound in nanometers |
lambdaMin
>= lambdaMax
, the implementation will return zero. Reimplemented from mitsuba::ContinuousSpectrum.
void mitsuba::InterpolatedSpectrum::clear | ( | ) |
Clear all stored entries.
Return the value of the spectral power distribution at the given wavelength.
Implements mitsuba::ContinuousSpectrum.
|
virtual |
Return a string representation.
Implements mitsuba::ContinuousSpectrum.
void mitsuba::InterpolatedSpectrum::zeroExtend | ( | ) |
This function adds a zero entry before and after the stored wavelength range.
This is useful when handling datasets that don't fall off to zero at the ends. The spacing of the added entries is determined by computing the average spacing of the existing samples.
|
protected |
|
protected |