CCCoreLib 31 May 2022
CloudCompare Core algorithms
|
The Normal/Gaussian statistical distribution. More...
#include <NormalDistribution.h>
Public Member Functions | |
NormalDistribution () | |
NormalDistribution constructor. | |
NormalDistribution (ScalarType _mu, ScalarType _sigma2) | |
NormalDistribution constructor. More... | |
bool | computeParameters (const ScalarContainer &values) override |
Computes the distribution parameters from a set of values. More... | |
double | computeP (ScalarType x) const override |
Computes the probability of x. More... | |
double | computePfromZero (ScalarType x) const override |
Computes the cumulative probability between 0 and x. More... | |
double | computeP (ScalarType x1, ScalarType x2) const override |
Computes the cumulative probability between x1 and x2. More... | |
double | computeChi2Dist (const GenericCloud *Yk, unsigned numberOfClasses, int *histo=nullptr) override |
Computes the Chi2 distance (related to the Chi2 Test) More... | |
const char * | getName () const override |
Returns distribution name. More... | |
bool | getParameters (ScalarType &_mu, ScalarType &_sigma2) const |
Returns the distribution parameters. More... | |
bool | setParameters (ScalarType _mu, ScalarType _sigma2) |
Sets the distribution parameters. More... | |
ScalarType | getMu () const |
Returns the distribution mean. | |
ScalarType | getSigma2 () const |
Returns the distribution variance. | |
bool | computeParameters (const GenericCloud *cloud) |
Computes the distribution parameters from a point cloud (with scalar values) | |
bool | computeRobustParameters (const ScalarContainer &values, double nSigma) |
Computes robust parameters for the distribution from an array of scalar values. More... | |
Public Member Functions inherited from CCCoreLib::GenericDistribution | |
GenericDistribution () | |
Default constructor. | |
virtual | ~GenericDistribution ()=default |
Default destructor. | |
virtual const char * | getName () const =0 |
Returns distribution name. More... | |
virtual bool | isValid () const |
Indicates if the distribution parameters are valid. More... | |
virtual bool | computeParameters (const ScalarContainer &values)=0 |
Computes the distribution parameters from a set of values. More... | |
virtual double | computeP (ScalarType x) const =0 |
Computes the probability of x. More... | |
virtual double | computePfromZero (ScalarType x) const =0 |
Computes the cumulative probability between 0 and x. More... | |
virtual double | computeP (ScalarType x1, ScalarType x2) const =0 |
Computes the cumulative probability between x1 and x2. More... | |
virtual double | computeChi2Dist (const GenericCloud *Yk, unsigned numberOfClasses, int *histo=nullptr)=0 |
Computes the Chi2 distance (related to the Chi2 Test) More... | |
Protected Member Functions | |
virtual bool | setChi2ClassesPositions (unsigned numberOfClasses) |
Compute each Chi2 class limits. More... | |
Protected Member Functions inherited from CCCoreLib::GenericDistribution | |
void | setValid (bool state) |
Sets distribution current validity. | |
Protected Attributes | |
ScalarType | m_mu |
Mean. | |
ScalarType | m_sigma2 |
Variance. | |
double | m_qFactor |
Exponential quotient. | |
double | m_normFactor |
Normalization factor. | |
std::vector< ScalarType > | m_chi2ClassesPositions |
Chi2 classes limits. More... | |
std::vector< ScalarType > | m_Pi |
Structure used during the Chi2 distance computation. | |
Protected Attributes inherited from CCCoreLib::GenericDistribution | |
bool | m_isValid |
Whether the distribution is in a valid state or not. | |
Additional Inherited Members | |
Public Types inherited from CCCoreLib::GenericDistribution | |
using | ScalarContainer = std::vector< ScalarType > |
Scalar values container. | |
The Normal/Gaussian statistical distribution.
Implements the GenericDistribution interface.
NormalDistribution::NormalDistribution | ( | ScalarType | _mu, |
ScalarType | _sigma2 | ||
) |
NormalDistribution constructor.
Distrubtion parameters can be directly set during object construction.
_mu | the normal distribution mean |
_sigma2 | the normal distribution variance |
|
overridevirtual |
Computes the Chi2 distance (related to the Chi2 Test)
Computes the Chi2 distance from a group of point, accordingly to a certain number of classes (see Chi2 test theory for more information). The result of projecting each point (or more precisely each scalar value associated to each point) in the different classes can be stored in an array (of the same size as the number of classes). To do so, such an array (already allocated in memory) should be passed as an argument. Warning: be sure to activate an OUTPUT scalar field on the input cloud
Yk | a group of points |
numberOfClasses | the number of classes for the Chi2 Test |
histo | an array to store the values projection result (optional) |
Implements CCCoreLib::GenericDistribution.
|
overridevirtual |
Computes the probability of x.
x | the variable |
Implements CCCoreLib::GenericDistribution.
|
overridevirtual |
Computes the cumulative probability between x1 and x2.
x1 should be lower than x2
x1 | the lower boundary |
x2 | the upper boundary |
Implements CCCoreLib::GenericDistribution.
|
overridevirtual |
Computes the distribution parameters from a set of values.
values | a set of scalar values |
Implements CCCoreLib::GenericDistribution.
|
overridevirtual |
Computes the cumulative probability between 0 and x.
x | the upper boundary |
Implements CCCoreLib::GenericDistribution.
bool NormalDistribution::computeRobustParameters | ( | const ScalarContainer & | values, |
double | nSigma | ||
) |
Computes robust parameters for the distribution from an array of scalar values.
Specific method to compute the parameters directly from an array (vector) of scalar values, without associated points. After a first pass, only the values close enough to the mean (in terms of nSigma times the initial variance) are kept to make a second and more robust evaluation of the parameters.
values | the scalar values |
nSigma | the values filtering interval size ([mu -nSigma * stddev : mu + nSigma * stddev]) |
|
inlineoverridevirtual |
Returns distribution name.
Implements CCCoreLib::GenericDistribution.
bool NormalDistribution::getParameters | ( | ScalarType & | _mu, |
ScalarType & | _sigma2 | ||
) | const |
Returns the distribution parameters.
_mu | a field to transmit the distribution mean |
_sigma2 | a field to transmit the distribution variance return the parameters validity |
|
protectedvirtual |
Compute each Chi2 class limits.
This method is used (internally) to accelerate the Chi2 distance computation.
numberOfClasses | the number of classes that will be used for Chi2 distance computation |
bool NormalDistribution::setParameters | ( | ScalarType | _mu, |
ScalarType | _sigma2 | ||
) |
Sets the distribution parameters.
_mu | the distribution mean |
_sigma2 | the distribution variance return the parameters validity |
|
protected |
Chi2 classes limits.
Used internally. Stores both limits for each class in a vector (min_class_1, max_class_1, min_class_2, max_class_2, etc.).