Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::SampleFlow Class Referencefinal

A sample with arbitrary dimensions with fine-grained sampling control. More...

#include <SampleFlow.h>

Public Member Functions

 SampleFlow ()
 Creates a flow of totally random values.
 
 SampleFlow (const real *savedDims, std::size_t numSavedDims)
 Creates a flow with the first N dimensions pre-calculated.
 
real flow1D ()
 Makes a 1-D sample by consuming the next dimension.
 
std::array< real, 2 > flow2D ()
 Makes a 2-D sample by consuming the next two dimensions.
 
std::array< real, 3 > flow3D ()
 Makes a 3-D sample by consuming the next three dimensions.
 
template<std::size_t N>
std::array< real, N > flowND ()
 Makes a N-D sample by consuming the next N dimension.
 
bool pick (real pickProbability)
 Consumes the next dimension and use it to perform a random pick. Effectively using flow1D() to perform a random pick.
 
bool unflowedPick (real pickProbability)
 Uses the next dimension to perform a random pick without consuming it. This method does not cause the sample stream to flow.
 
bool unflowedRandomPick (real pickProbability)
 Performs a random pick independent to this flow. No dimension is being consumed. This method is intentionally non-const to support sample recording.
 

Detailed Description

A sample with arbitrary dimensions with fine-grained sampling control.

Constructor & Destructor Documentation

◆ SampleFlow() [1/2]

ph::SampleFlow::SampleFlow ( )
inline

Creates a flow of totally random values.

◆ SampleFlow() [2/2]

ph::SampleFlow::SampleFlow ( const real * savedDims,
std::size_t numSavedDims )
inline

Creates a flow with the first N dimensions pre-calculated.

Member Function Documentation

◆ flow1D()

real ph::SampleFlow::flow1D ( )
inline

Makes a 1-D sample by consuming the next dimension.

Returns
A 1-D sample.

◆ flow2D()

std::array< real, 2 > ph::SampleFlow::flow2D ( )
inline

Makes a 2-D sample by consuming the next two dimensions.

Returns
A 2-D sample.

◆ flow3D()

std::array< real, 3 > ph::SampleFlow::flow3D ( )
inline

Makes a 3-D sample by consuming the next three dimensions.

Returns
A 3-D sample.

◆ flowND()

template<std::size_t N>
std::array< real, N > ph::SampleFlow::flowND ( )
inline

Makes a N-D sample by consuming the next N dimension.

Template Parameters
NNumber of dimensions of the sample.
Returns
A N-D sample.

◆ pick()

bool ph::SampleFlow::pick ( real pickProbability)
inline

Consumes the next dimension and use it to perform a random pick. Effectively using flow1D() to perform a random pick.

Parameters
pickProbabilityThe probability for the pick to succeed.
Returns
true if the pick is successful, otherwise false. The probability for the pick to be successful is equal to pickProbability, assuming the source of the sample flow is uniformly random.

◆ unflowedPick()

bool ph::SampleFlow::unflowedPick ( real pickProbability)
inline

Uses the next dimension to perform a random pick without consuming it. This method does not cause the sample stream to flow.

Parameters
pickProbabilityThe probability for the pick to succeed.
Returns
true if the pick is successful, otherwise false. The probability for the pick to be successful is equal to pickProbability, assuming the source of the sample flow is uniformly random.
Remarks
Though the sample stream does not flow, the randomness in the bits of the next dimension will decrease after each call. Rare event loses more randomness.

◆ unflowedRandomPick()

bool ph::SampleFlow::unflowedRandomPick ( real pickProbability)
inline

Performs a random pick independent to this flow. No dimension is being consumed. This method is intentionally non-const to support sample recording.

Parameters
pickProbabilityThe probability for the pick to succeed.
Returns
true if the pick is successful, otherwise false. The probability for the pick to be successful is equal to pickProbability, assuming the source of the sample flow is uniformly random.

The documentation for this class was generated from the following file: