Path Tracer
|
a wave sample representing a continuous wave in discreet form More...
#include <wave.hpp>
Public Member Functions | |
sampled_wave (T val, unsigned int size) | |
a constant value constructor More... | |
sampled_wave (const std::vector< T > &vals) | |
directly construct from given values. More... | |
T | max () const |
gives the maximum value among sampled points | |
T | min () const |
gives the minimum value among sampled points | |
bool | has_nans () const |
check if sampled power values contain nan value. | |
bool | has_zeros () const |
check if sampled power values contain 0 value. | |
bool | is_black () const |
check if sampled power values contain only 0 value. | |
sampled_wave & | operator= (const sampled_wave &s) |
assign a sample wave to this wave if it does not contain nan values | |
sampled_wave | apply (unsigned int index, T value, const std::function< T(T, T)> &fn) const |
sampled_wave | apply (T value, const std::function< T(T, T)> &fn) const |
sampled_wave | apply (const sampled_wave &s, const std::function< T(T, T)> &fn) const |
apply a function to same sized wave samples More... | |
sampled_wave & | operator+= (const sampled_wave &s) const |
sampled_wave & | operator+= (const T &s) const |
sampled_wave | operator+ (const sampled_wave &s) const |
add two same sized sampled waves | |
sampled_wave | operator+ (const T &s) const |
add given power value to all of the elements of the sampled wave. | |
sampled_wave & | operator-= (const sampled_wave &s) const |
sampled_wave & | operator-= (const T &s) const |
sampled_wave | operator- (const sampled_wave &s) const |
subtract two same sized sampled waves | |
sampled_wave | operator- (const T &s) const |
subtract power value from this wave More... | |
sampled_wave & | operator*= (const sampled_wave &s) const |
sampled_wave & | operator*= (const T &s) const |
sampled_wave | operator* (const sampled_wave &s) const |
multiply two same sized sampled waves | |
sampled_wave | operator* (const T &s) const |
multiply given power value to all of the elements of the sampled wave. | |
sampled_wave & | operator/= (const sampled_wave &s) |
sampled_wave & | operator/= (const T &s) const |
sampled_wave | operator/ (const sampled_wave &s) const |
divide two same sized sampled waves | |
sampled_wave | operator/ (const T &s) const |
divide power value from this wave More... | |
T & | operator[] (uint i) |
access to power value at given index. Mostly used for setting a new value for the given index; More... | |
T | operator[] (uint i) const |
access to power value at given index. Mostly used for reading the value of the given index; More... | |
bool | operator== (const sampled_wave &cs) const |
check if given sampled wave has same power with this one. More... | |
bool | operator!= (const sampled_wave &cs) const |
check if given sampled_wave is not equal to this or not | |
T | reduce (const std::function< T(T, T)> &fn, T counter_value) const |
reduce power values of this wave to a single value using given function More... | |
T | sum () const |
reduce sampled wave by summation | |
T | product () const |
reduce sampled wave by multiplication | |
Real | average () const |
find the average value of this wave | |
uint | size () const |
find the number of samples inside this wave | |
sampled_wave | clamp (T low=0.0, T high=FLT_MAX) |
clamp power values of this wave to given range We also check if the resulting wave has nan values. More... | |
sampled_wave | interpolate (Real low=0.0, Real high=FLT_MAX) |
Public Attributes | |
std::vector< T > | values |
holds observed power values of the wave | |
Friends | |
sampled_wave | operator+ (const T &s, const sampled_wave &ss) |
sampled_wave | operator- (const T &s, const sampled_wave &ss) |
subtract every element of given sampled_wave from the value | |
sampled_wave | operator* (const T &s, const sampled_wave &ss) |
sampled_wave | operator/ (const T &s, const sampled_wave &ss) |
divide power value from this wave More... | |
a wave sample representing a continuous wave in discreet form
|
inline |
a constant value constructor
We give the number of samples and a constant value in order to initialize the sampled wave with a single value like 0, or 420
size | determines the number of samples of the wave |
val | the constant power value. |
|
inline |
directly construct from given values.
We construct the wave directly from samples. We only check for nan values.
vals | a vector of values |
|
inline |
apply a function to same sized wave samples
fn | function to be applied to power values |
|
inline |
\brief apply a function to all power values. \param fn function to be applied to power values \return a new wave
TODO:
|
inline |
\brief apply a function to a single power value. We check whether the operation produces a negative value
as well.
\param index index of the power value among values
vector
fn | function to be applied to the power value at index. |
TODO
|
inline |
clamp power values of this wave to given range We also check if the resulting wave has nan values.
low | low end of the range |
high | high end of the range |
|
inline |
\brief multiply and assign values of given sampled
wave
TODO
|
inline |
\brief multiply and the given power value to this
wave.
TODO
|
inline |
\brief add and assign values of given sampled wave
TODO
|
inline |
\brief add and the given power value to this wave.
TODO
|
inline |
subtract power value from this wave
We check whether the new value is producing negative power values.
|
inline |
\brief subtract and assign values of given sampled wave
TODO
|
inline |
\brief subtract and the given power value to this
wave.
TODO
|
inline |
divide power value from this wave
s | value to divide We check if s is 0 then perform the division. |
|
inline |
\brief divide and assign values of given sampled wave
TODO
|
inline |
\brief divide and the given power value to this
wave.
TODO
|
inline |
check if given sampled wave has same power with this one.
cs | comparison wave |
|
inline |
access to power value at given index. Mostly used for setting a new value for the given index;
|
inline |
access to power value at given index. Mostly used for reading the value of the given index;
|
inline |
reduce power values of this wave to a single value using given function
fn | function that is applied during reduction |
counter_value | initial value assigned to aggregating variable |
|
friend |
|
friend |
|
friend |
divide power value from this wave
s | value to divide |
ss | wave to divide. |
We check if s is 0, then divide 1 by s. Then we perform a mutliplication of the resulting value with the ss.