|
Krita Source Code Documentation
|
Class that can generate randomly distributed values in the range [a..b] following an arbitrary pdf. More...
#include <KisSprayRandomDistributions.h>
Inheritance diagram for KisSprayFunctionBasedDistribution:Classes | |
| class | Private |
Public Member Functions | |
| bool | isValid () const |
| Return if this object is correctly initialized and can be used to generate values. | |
| KisSprayFunctionBasedDistribution () | |
| Construct an invalid KisSprayFunctionBasedDistribution. | |
| KisSprayFunctionBasedDistribution (const KisSprayFunctionBasedDistribution &other) | |
| template<typename Function > | |
| KisSprayFunctionBasedDistribution (int numberOfSamples, double a, double b, Function f) | |
| Construct a new distribution. | |
| double | max () const |
| Return the maximum value that this distribution can produce. | |
| double | min () const |
| Return the minimum value that this distribution can produce. | |
| double | operator() (KisRandomSourceSP rs) const |
| Get a random value between min and max that follows the distribution. | |
| KisSprayFunctionBasedDistribution & | operator= (const KisSprayFunctionBasedDistribution &rhs) |
| ~KisSprayFunctionBasedDistribution () | |
Protected Member Functions | |
| template<typename Function > | |
| void | initialize (size_t numberOfSamples, double a, double b, Function f) |
| Function used to setup the distribution and put it in a valid state. See the constructor for the explanation of the parameters. | |
Private Attributes | |
| QScopedPointer< Private > | m_d |
Class that can generate randomly distributed values in the range [a..b] following an arbitrary pdf.
Definition at line 19 of file KisSprayRandomDistributions.h.
| KisSprayFunctionBasedDistribution::KisSprayFunctionBasedDistribution | ( | ) |
Construct an invalid KisSprayFunctionBasedDistribution.
Definition at line 162 of file KisSprayRandomDistributions.cpp.
| KisSprayFunctionBasedDistribution::KisSprayFunctionBasedDistribution | ( | int | numberOfSamples, |
| double | a, | ||
| double | b, | ||
| Function | f ) |
Construct a new distribution.
| Function | Type of the functor to sample from |
| numberOfSamples | Number of points to sample from the function. They are sampled evenly through the range [a..b]. The first point will be sampled at a and the last one at b. |
| a | The lower bound of the domain of the function. The sampling will start here |
| b | The upper bound of the domain of the function. The sampling will start here |
| f | The functor that will be used to get the samples |
Definition at line 167 of file KisSprayRandomDistributions.cpp.
References m_d.
| KisSprayFunctionBasedDistribution::~KisSprayFunctionBasedDistribution | ( | ) |
Definition at line 173 of file KisSprayRandomDistributions.cpp.
| KisSprayFunctionBasedDistribution::KisSprayFunctionBasedDistribution | ( | const KisSprayFunctionBasedDistribution & | other | ) |
|
protected |
Function used to setup the distribution and put it in a valid state. See the constructor for the explanation of the parameters.
Definition at line 215 of file KisSprayRandomDistributions.cpp.
References m_d.
| bool KisSprayFunctionBasedDistribution::isValid | ( | ) | const |
Return if this object is correctly initialized and can be used to generate values.
Definition at line 209 of file KisSprayRandomDistributions.cpp.
References m_d.
| double KisSprayFunctionBasedDistribution::max | ( | ) | const |
Return the maximum value that this distribution can produce.
Definition at line 202 of file KisSprayRandomDistributions.cpp.
References isValid(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and m_d.
| double KisSprayFunctionBasedDistribution::min | ( | ) | const |
Return the minimum value that this distribution can produce.
Definition at line 195 of file KisSprayRandomDistributions.cpp.
References isValid(), KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, and m_d.
| double KisSprayFunctionBasedDistribution::operator() | ( | KisRandomSourceSP | rs | ) | const |
Get a random value between min and max that follows the distribution.
| rs | The random source object that will be used to get a uniform value |
Definition at line 190 of file KisSprayRandomDistributions.cpp.
References KisRandomSource::generateNormalized(), and m_d.
| KisSprayFunctionBasedDistribution & KisSprayFunctionBasedDistribution::operator= | ( | const KisSprayFunctionBasedDistribution & | rhs | ) |
|
private |
Definition at line 81 of file KisSprayRandomDistributions.h.