CCCoreLib 31 May 2022
CloudCompare Core algorithms
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CCCoreLib::NormalDistribution Class Reference

The Normal/Gaussian statistical distribution. More...

#include <NormalDistribution.h>

Inheritance diagram for CCCoreLib::NormalDistribution:
Inheritance graph
[legend]
Collaboration diagram for CCCoreLib::NormalDistribution:
Collaboration graph
[legend]

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.
 

Detailed Description

The Normal/Gaussian statistical distribution.

Implements the GenericDistribution interface.

Constructor & Destructor Documentation

◆ NormalDistribution()

NormalDistribution::NormalDistribution ( ScalarType  _mu,
ScalarType  _sigma2 
)

NormalDistribution constructor.

Distrubtion parameters can be directly set during object construction.

Parameters
_muthe normal distribution mean
_sigma2the normal distribution variance

Member Function Documentation

◆ computeChi2Dist()

double NormalDistribution::computeChi2Dist ( const GenericCloud Yk,
unsigned  numberOfClasses,
int *  histo = nullptr 
)
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

Parameters
Yka group of points
numberOfClassesthe number of classes for the Chi2 Test
histoan array to store the values projection result (optional)
Returns
the Chi2 distance (or -1.0 if an error occurred)

Implements CCCoreLib::GenericDistribution.

◆ computeP() [1/2]

double NormalDistribution::computeP ( ScalarType  x) const
overridevirtual

Computes the probability of x.

Parameters
xthe variable
Returns
the probabilty

Implements CCCoreLib::GenericDistribution.

◆ computeP() [2/2]

double NormalDistribution::computeP ( ScalarType  x1,
ScalarType  x2 
) const
overridevirtual

Computes the cumulative probability between x1 and x2.

x1 should be lower than x2

Parameters
x1the lower boundary
x2the upper boundary
Returns
the cumulative probabilty

Implements CCCoreLib::GenericDistribution.

◆ computeParameters()

bool NormalDistribution::computeParameters ( const ScalarContainer values)
overridevirtual

Computes the distribution parameters from a set of values.

Parameters
valuesa set of scalar values
Returns
true (if the computation succeeded) or false (if not)

Implements CCCoreLib::GenericDistribution.

◆ computePfromZero()

double NormalDistribution::computePfromZero ( ScalarType  x) const
overridevirtual

Computes the cumulative probability between 0 and x.

Parameters
xthe upper boundary
Returns
the cumulative probabilty

Implements CCCoreLib::GenericDistribution.

◆ computeRobustParameters()

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.

Parameters
valuesthe scalar values
nSigmathe values filtering interval size ([mu -nSigma * stddev : mu + nSigma * stddev])
Returns
the validity of the computed parameters

◆ getName()

const char * CCCoreLib::NormalDistribution::getName ( ) const
inlineoverridevirtual

Returns distribution name.

Implements CCCoreLib::GenericDistribution.

◆ getParameters()

bool NormalDistribution::getParameters ( ScalarType &  _mu,
ScalarType &  _sigma2 
) const

Returns the distribution parameters.

Parameters
_mua field to transmit the distribution mean
_sigma2a field to transmit the distribution variance return the parameters validity

◆ setChi2ClassesPositions()

bool NormalDistribution::setChi2ClassesPositions ( unsigned  numberOfClasses)
protectedvirtual

Compute each Chi2 class limits.

This method is used (internally) to accelerate the Chi2 distance computation.

Parameters
numberOfClassesthe number of classes that will be used for Chi2 distance computation
Returns
success

◆ setParameters()

bool NormalDistribution::setParameters ( ScalarType  _mu,
ScalarType  _sigma2 
)

Sets the distribution parameters.

Parameters
_muthe distribution mean
_sigma2the distribution variance return the parameters validity

Member Data Documentation

◆ m_chi2ClassesPositions

std::vector<ScalarType> CCCoreLib::NormalDistribution::m_chi2ClassesPositions
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.).


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