ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::NormalDistribution Class Reference

The Normal/Gaussian statistical distribution. More...

#include <NormalDistribution.h>

Inheritance diagram for cloudViewer::NormalDistribution:
Collaboration diagram for cloudViewer::NormalDistribution:

Public Member Functions

 NormalDistribution ()
 NormalDistribution constructor. More...
 
 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. More...
 
ScalarType getSigma2 () const
 Returns the distribution variance. More...
 
bool computeParameters (const GenericCloud *cloud)
 
bool computeRobustParameters (const ScalarContainer &values, double nSigma)
 
- Public Member Functions inherited from cloudViewer::GenericDistribution
 GenericDistribution ()
 Default constructor. More...
 
virtual ~GenericDistribution ()=default
 Default destructor. More...
 
virtual bool isValid () const
 Indicates if the distribution parameters are valid. More...
 

Protected Member Functions

virtual bool setChi2ClassesPositions (unsigned numberOfClasses)
 Compute each Chi2 class limits. More...
 
- Protected Member Functions inherited from cloudViewer::GenericDistribution
void setValid (bool state)
 Sets distribution current validity. More...
 

Protected Attributes

ScalarType m_mu
 Mean. More...
 
ScalarType m_sigma2
 Variance. More...
 
double m_qFactor
 Exponential quotient. More...
 
double m_normFactor
 Normalization factor. More...
 
std::vector< ScalarType > m_chi2ClassesPositions
 Chi2 classes limits. More...
 
std::vector< ScalarType > m_Pi
 Structure used during the Chi2 distance computation. More...
 
- Protected Attributes inherited from cloudViewer::GenericDistribution
bool m_isValid
 Whether the distribution is in a valid state or not. More...
 

Additional Inherited Members

- Public Types inherited from cloudViewer::GenericDistribution
using ScalarContainer = std::vector< ScalarType >
 Scalar values container. More...
 

Detailed Description

The Normal/Gaussian statistical distribution.

Implements the GenericDistribution interface.

Definition at line 18 of file NormalDistribution.h.

Constructor & Destructor Documentation

◆ NormalDistribution() [1/2]

NormalDistribution::NormalDistribution ( )

NormalDistribution constructor.

Definition at line 24 of file NormalDistribution.cpp.

◆ NormalDistribution() [2/2]

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

Definition at line 31 of file NormalDistribution.cpp.

References setParameters().

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 cloudViewer::GenericDistribution.

Definition at line 164 of file NormalDistribution.cpp.

References cloudViewer::ScalarFieldTools::countScalarFieldValidValues(), cloudViewer::GenericCloud::getPointScalarValue(), m_chi2ClassesPositions, m_Pi, setChi2ClassesPositions(), cloudViewer::GenericCloud::size(), and cloudViewer::ScalarField::ValidValue().

◆ computeP() [1/2]

double NormalDistribution::computeP ( ScalarType  x) const
overridevirtual

Computes the probability of x.

Parameters
xthe variable
Returns
the probabilty

Implements cloudViewer::GenericDistribution.

Definition at line 64 of file NormalDistribution.cpp.

References m_mu, m_normFactor, and m_qFactor.

◆ 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 cloudViewer::GenericDistribution.

Definition at line 69 of file NormalDistribution.cpp.

References cloudViewer::ErrorFunction::erf(), m_mu, and m_sigma2.

◆ computeParameters() [1/2]

bool NormalDistribution::computeParameters ( const GenericCloud cloud)

◆ computeParameters() [2/2]

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 cloudViewer::GenericDistribution.

Definition at line 109 of file NormalDistribution.cpp.

References abs(), setParameters(), cloudViewer::GenericDistribution::setValid(), and cloudViewer::ScalarField::ValidValue().

Referenced by computeRobustParameters(), define_NormalDistribution(), and cloudViewer::ICPRegistrationTools::Register().

◆ 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 cloudViewer::GenericDistribution.

Definition at line 76 of file NormalDistribution.cpp.

References cloudViewer::ErrorFunction::erf(), m_mu, and m_sigma2.

Referenced by setChi2ClassesPositions().

◆ 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

Definition at line 135 of file NormalDistribution.cpp.

References abs(), computeParameters(), m_mu, m_sigma2, and setParameters().

Referenced by define_NormalDistribution().

◆ getMu()

ScalarType cloudViewer::NormalDistribution::getMu ( ) const
inline

Returns the distribution mean.

Definition at line 56 of file NormalDistribution.h.

Referenced by define_NormalDistribution().

◆ getName()

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

Returns distribution name.

Implements cloudViewer::GenericDistribution.

Definition at line 39 of file NormalDistribution.h.

◆ 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

Definition at line 35 of file NormalDistribution.cpp.

References cloudViewer::GenericDistribution::isValid(), m_mu, and m_sigma2.

Referenced by cloudViewer::ICPRegistrationTools::Register(), and cloudViewer::StatisticalTestingTools::testCloudWithStatisticalModel().

◆ getSigma2()

ScalarType cloudViewer::NormalDistribution::getSigma2 ( ) const
inline

Returns the distribution variance.

Definition at line 59 of file NormalDistribution.h.

Referenced by define_NormalDistribution().

◆ 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

Definition at line 221 of file NormalDistribution.cpp.

References computePfromZero(), cloudViewer::GenericDistribution::isValid(), m_chi2ClassesPositions, m_mu, m_Pi, and m_sigma2.

Referenced by computeChi2Dist().

◆ setParameters()

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

Sets the distribution parameters.

Parameters
_muthe distribution mean
_sigma2the distribution variance return the parameters validity

Definition at line 43 of file NormalDistribution.cpp.

References cloudViewer::GenericDistribution::isValid(), m_chi2ClassesPositions, m_mu, m_normFactor, M_PI, m_Pi, m_qFactor, m_sigma2, and cloudViewer::GenericDistribution::setValid().

Referenced by computeParameters(), computeRobustParameters(), define_NormalDistribution(), NormalDistribution(), CommandStatTest::process(), and ccEntityAction::statisticalTest().

Member Data Documentation

◆ m_chi2ClassesPositions

std::vector<ScalarType> cloudViewer::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.).

Definition at line 98 of file NormalDistribution.h.

Referenced by computeChi2Dist(), setChi2ClassesPositions(), and setParameters().

◆ m_mu

ScalarType cloudViewer::NormalDistribution::m_mu
protected

◆ m_normFactor

double cloudViewer::NormalDistribution::m_normFactor
protected

Normalization factor.

Definition at line 92 of file NormalDistribution.h.

Referenced by computeP(), and setParameters().

◆ m_Pi

std::vector<ScalarType> cloudViewer::NormalDistribution::m_Pi
protected

Structure used during the Chi2 distance computation.

Definition at line 101 of file NormalDistribution.h.

Referenced by computeChi2Dist(), setChi2ClassesPositions(), and setParameters().

◆ m_qFactor

double cloudViewer::NormalDistribution::m_qFactor
protected

Exponential quotient.

Definition at line 90 of file NormalDistribution.h.

Referenced by computeP(), and setParameters().

◆ m_sigma2

ScalarType cloudViewer::NormalDistribution::m_sigma2
protected

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