#include <mcdistribution.h>
Public Member Functions | |
IrregularDistribution1D (float aX0, float aX1, float *aX, float *aFx, int aN) | |
~IrregularDistribution1D () | |
float | Sample (float u, float *pdf) const |
float | Eval (float x) const |
int | IndexOf (float x, float *d) const |
Public Attributes | |
float | x0 |
float | x1 |
float * | xFunc |
float * | yFunc |
float * | xCdf |
float * | yCdf |
float | funcInt |
float | invFuncInt |
float | invCount |
int | count |
A utility class for sampling from a irregularly sampled 1D distribution.
Definition at line 230 of file mcdistribution.h.
lux::IrregularDistribution1D::IrregularDistribution1D | ( | float | aX0, | |
float | aX1, | |||
float * | aX, | |||
float * | aFx, | |||
int | aN | |||
) | [inline] |
Creates a 1D distribution for the given function. It is assumed that the given x values are ordered, starting with the smallest value.
aX0 | The start of the sample interval. | |
aX1 | The end of the sample interval. | |
aX | The sample locations of the function. | |
aFx | The values of the function. | |
aN | The number of samples. |
Definition at line 243 of file mcdistribution.h.
References count, funcInt, invCount, invFuncInt, cimg_library::cimg::max(), memcpy(), x0, x1, xCdf, xFunc, yCdf, and yFunc.
lux::IrregularDistribution1D::~IrregularDistribution1D | ( | ) | [inline] |
float lux::IrregularDistribution1D::Eval | ( | float | x | ) | const [inline] |
Evaluates the function at the given position.
x | The x value to evaluate the function at. |
Definition at line 305 of file mcdistribution.h.
int lux::IrregularDistribution1D::IndexOf | ( | float | x, | |
float * | d | |||
) | const [inline] |
Returns the index of the given position.
x | The x value to get the index of. | |
d | The address to store the offset from the index in. |
Definition at line 327 of file mcdistribution.h.
float lux::IrregularDistribution1D::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 288 of file mcdistribution.h.
References Clamp(), count, invFuncInt, xCdf, xFunc, and yCdf.
Definition at line 365 of file mcdistribution.h.
Referenced by Eval(), IndexOf(), IrregularDistribution1D(), and Sample().
The function integral (of the scaled function!), the inverted function integral and the inverted count.
Definition at line 361 of file mcdistribution.h.
Referenced by IrregularDistribution1D().
Definition at line 361 of file mcdistribution.h.
Referenced by IrregularDistribution1D().
Definition at line 361 of file mcdistribution.h.
Referenced by IrregularDistribution1D(), and Sample().
The function interval.
Definition at line 348 of file mcdistribution.h.
Referenced by IrregularDistribution1D().
Definition at line 348 of file mcdistribution.h.
Referenced by IrregularDistribution1D().
Definition at line 356 of file mcdistribution.h.
Referenced by IrregularDistribution1D(), Sample(), and ~IrregularDistribution1D().
Definition at line 352 of file mcdistribution.h.
Referenced by Eval(), IndexOf(), IrregularDistribution1D(), Sample(), and ~IrregularDistribution1D().
Definition at line 356 of file mcdistribution.h.
Referenced by IrregularDistribution1D(), Sample(), and ~IrregularDistribution1D().
Definition at line 352 of file mcdistribution.h.
Referenced by Eval(), IrregularDistribution1D(), and ~IrregularDistribution1D().