#include <mcdistribution.h>
Public Member Functions | |
Distribution1D (float *f, int n) | |
~Distribution1D () | |
float | Sample (float u, float *pdf) const |
Public Attributes | |
float * | func |
float * | cdf |
float | funcInt |
float | invFuncInt |
float | invCount |
int | count |
A utility class for sampling from a regularly sampled 1D distribution.
Definition at line 81 of file mcdistribution.h.
lux::Distribution1D::Distribution1D | ( | float * | f, | |
int | n | |||
) | [inline] |
Creates a 1D distribution for the given function. It is assumed that the given function is sampled regularly sampled in the interval [0,1] (ex. 0.1, 0.3, 0.5, 0.7, 0.9 for 5 samples).
f | The values of the function. | |
n | The number of samples. |
Definition at line 91 of file mcdistribution.h.
References cdf, lux::ComputeStep1dCDF(), count, func, funcInt, invCount, invFuncInt, and memcpy().
lux::Distribution1D::~Distribution1D | ( | ) | [inline] |
Definition at line 100 of file mcdistribution.h.
float lux::Distribution1D::Sample | ( | float | u, | |
float * | ||||
) | const [inline] |
Samples from this distribution.
u | The random value used to sample. | |
The pointer to the float where the pdf of the sample should be stored. |
Definition at line 114 of file mcdistribution.h.
References cdf, count, func, invFuncInt, and cimg_library::cimg::max().
Referenced by lux::InfiniteAreaLightIS::Sample_L().
float * lux::Distribution1D::cdf |
Definition at line 129 of file mcdistribution.h.
Referenced by Distribution1D(), Sample(), and ~Distribution1D().
Definition at line 138 of file mcdistribution.h.
Referenced by Distribution1D(), lux::InfiniteAreaLightIS::Pdf(), Sample(), and lux::InfiniteAreaLightIS::Sample_L().
float* lux::Distribution1D::func |
Definition at line 129 of file mcdistribution.h.
Referenced by Distribution1D(), lux::InfiniteAreaLightIS::Pdf(), Sample(), and ~Distribution1D().
The function integral (assuming it is regularly sampled with an interval of 1), the inverted function integral and the inverted count.
Definition at line 134 of file mcdistribution.h.
Referenced by Distribution1D(), and lux::InfiniteAreaLightIS::Pdf().
Definition at line 134 of file mcdistribution.h.
Referenced by Distribution1D(), and lux::InfiniteAreaLightIS::Sample_L().
Definition at line 134 of file mcdistribution.h.
Referenced by Distribution1D(), and Sample().