CCCoreLib 31 May 2022
CloudCompare Core algorithms
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CCCoreLib::GenericDistribution Class Referenceabstract

A generic class to handle a probability distribution. More...

#include <GenericDistribution.h>

Inheritance diagram for CCCoreLib::GenericDistribution:
Inheritance graph
[legend]

Public Types

using ScalarContainer = std::vector< ScalarType >
 Scalar values container.
 

Public Member Functions

 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

void setValid (bool state)
 Sets distribution current validity.
 

Protected Attributes

bool m_isValid
 Whether the distribution is in a valid state or not.
 

Detailed Description

A generic class to handle a probability distribution.

Custom parametric distributions can be implemented through this interface and used for filtering data (see StatisticalTestingTools).

Member Function Documentation

◆ computeChi2Dist()

virtual double CCCoreLib::GenericDistribution::computeChi2Dist ( const GenericCloud Yk,
unsigned  numberOfClasses,
int *  histo = nullptr 
)
pure virtual

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)

Implemented in CCCoreLib::WeibullDistribution, and CCCoreLib::NormalDistribution.

◆ computeP() [1/2]

virtual double CCCoreLib::GenericDistribution::computeP ( ScalarType  x) const
pure virtual

Computes the probability of x.

Parameters
xthe variable
Returns
the probabilty

Implemented in CCCoreLib::NormalDistribution, and CCCoreLib::WeibullDistribution.

◆ computeP() [2/2]

virtual double CCCoreLib::GenericDistribution::computeP ( ScalarType  x1,
ScalarType  x2 
) const
pure virtual

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

Implemented in CCCoreLib::NormalDistribution, and CCCoreLib::WeibullDistribution.

◆ computeParameters()

virtual bool CCCoreLib::GenericDistribution::computeParameters ( const ScalarContainer values)
pure virtual

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)

Implemented in CCCoreLib::NormalDistribution, and CCCoreLib::WeibullDistribution.

◆ computePfromZero()

virtual double CCCoreLib::GenericDistribution::computePfromZero ( ScalarType  x) const
pure virtual

Computes the cumulative probability between 0 and x.

Parameters
xthe upper boundary
Returns
the cumulative probabilty

Implemented in CCCoreLib::NormalDistribution, and CCCoreLib::WeibullDistribution.

◆ getName()

virtual const char * CCCoreLib::GenericDistribution::getName ( ) const
pure virtual

Returns distribution name.

Implemented in CCCoreLib::NormalDistribution, and CCCoreLib::WeibullDistribution.

◆ isValid()

virtual bool CCCoreLib::GenericDistribution::isValid ( ) const
inlinevirtual

Indicates if the distribution parameters are valid.

This function is related to 'computeParameters()'. If the parameters computation failed, then the parameters will be marked as 'invalid'. In this case, the dsitribution should'nt be used (most of the methods won't work anyway).

Returns
true (if the distribution parameters are valid) or false (if not)

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