lux::IrregularDistribution1D Class Reference

#include <mcdistribution.h>

Collaboration diagram for lux::IrregularDistribution1D:
[legend]

List of all members.

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

Detailed Description

A utility class for sampling from a irregularly sampled 1D distribution.

Definition at line 230 of file mcdistribution.h.


Constructor & Destructor Documentation

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.

Parameters:
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]

Definition at line 272 of file mcdistribution.h.

References xCdf, xFunc, yCdf, and yFunc.


Member Function Documentation

float lux::IrregularDistribution1D::Eval ( float  x  )  const [inline]

Evaluates the function at the given position.

Parameters:
x The x value to evaluate the function at.
Returns:
The function value at the given position.

Definition at line 305 of file mcdistribution.h.

References count, xFunc, and yFunc.

int lux::IrregularDistribution1D::IndexOf ( float  x,
float *  d 
) const [inline]

Returns the index of the given position.

Parameters:
x The x value to get the index of.
d The address to store the offset from the index in.
Returns:
The index of the given position.

Definition at line 327 of file mcdistribution.h.

References count, and xFunc.

float lux::IrregularDistribution1D::Sample ( float  u,
float *  pdf 
) const [inline]

Samples from this distribution.

Parameters:
u The random value used to sample.
pdf The pointer to the float where the pdf of the sample should be stored.
Returns:
The x value of the sample (i.e. the x in f(x)).

Definition at line 288 of file mcdistribution.h.

References Clamp(), count, invFuncInt, xCdf, xFunc, and yCdf.


Member Data Documentation

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 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().


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208