Krita Source Code Documentation
Loading...
Searching...
No Matches
KisSprayRandomDistributions.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 Deif Lou <ginoba@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KISSPRAYRANDOMDISTRIBUTIONS_H
8#define KISSPRAYRANDOMDISTRIBUTIONS_H
9
10#include <QScopedPointer>
11
12#include <kis_random_source.h>
13#include <kis_cubic_curve.h>
14
20{
21public:
26
40 template <typename Function>
41 KisSprayFunctionBasedDistribution(int numberOfSamples, double a, double b, Function f);
42
46
53 double operator()(KisRandomSourceSP rs) const;
54
58 double min() const;
59
63 double max() const;
64
69 bool isValid() const;
70
71protected:
76 template <typename Function>
77 void initialize(size_t numberOfSamples, double a, double b, Function f);
78
79private:
80 class Private;
81 QScopedPointer<Private> m_d;
82};
83
89{
90public:
97 double operator()(KisRandomSourceSP rs) const;
98
102 double min() const { return 0.0; }
103
107 double max() const { return 1.0; }
108
113 bool isValid() const { return true; }
114};
115
125
131{
132public:
137
144 KisSprayNormalDistribution(double mean, double standardDeviation);
145};
146
159
166{
167public:
172
184 explicit KisSprayClusterBasedDistribution(double clusteringAmount);
185};
186
199
205{
206public:
211
218 explicit KisSprayCurveBasedDistribution(const KisCubicCurve &curve, size_t repeat = 1);
219};
220
233
234#endif
Class that can generate randomly distributed values in the range [0..1] that follow a distribution th...
Class that can generate randomly distributed values in the range [0..1] that follow a distribution th...
KisSprayClusterBasedDistribution()
Construct an invalid KisSprayClusterBasedDistribution.
Class that can generate randomly distributed values in the range [0..1] that follow a distribution gi...
Class that can generate randomly distributed values in the range [0..1] that follow a distribution gi...
KisSprayCurveBasedDistribution()
Construct an invalid KisSprayCurveBasedDistribution.
Class that can generate randomly distributed values in the range [a..b] following an arbitrary pdf.
double min() const
Return the minimum value that this distribution can produce.
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 expl...
KisSprayFunctionBasedDistribution()
Construct an invalid KisSprayFunctionBasedDistribution.
KisSprayFunctionBasedDistribution & operator=(const KisSprayFunctionBasedDistribution &rhs)
bool isValid() const
Return if this object is correctly initialized and can be used to generate values.
double max() const
Return the maximum value that this distribution can produce.
double operator()(KisRandomSourceSP rs) const
Get a random value between min and max that follows the distribution.
Class that can generate normally distributed values. For efficiency, the values will be in the range ...
Class that can generate normally distributed values. For efficiency, the values will be in the range ...
KisSprayNormalDistribution()
Construct an invalid KisSprayNormalDistribution.
Class that can generate uniformly distributed values in the [0..1) range, for polar coordinates dista...
Class that can generate uniformly distributed values in the [0..1) range.
double min() const
Return the minimum value that this distribution can produce.
bool isValid() const
Return if this object is correctly initialized and can be used to generate values.
double max() const
Return the maximum value that this distribution can produce.
double operator()(KisRandomSourceSP rs) const
Get a random value between min and max that follows a uniform distribution.