89 if (
this == &o)
return;
127 cov = M*
cov*M.transpose();
152 mean.
x(
x.get_unsafe(0,0) );
153 mean.
y(
x.get_unsafe(1,0) );
155 std::cout <<
"IN1: " << p1.
mean <<
"\n" << p1.
cov <<
"\n";
156 std::cout <<
"IN2: " << p2.
mean <<
"\n" << p2.
cov <<
"\n";
157 std::cout <<
"OUT: " <<
mean <<
"\n" <<
cov <<
"\n";
180 MU.get_unsafe(0,0) =
mean.
x() -
p.mean.x();
181 MU.get_unsafe(1,0) =
mean.
y() -
p.mean.y();
184 * (1.0/std::sqrt( C.det() ))
185 * exp( -0.5* MU.multiply_HtCH_scalar(C_inv) );
211 outSample.
x(
mean.
x() + vec[0] );
212 outSample.
y(
mean.
y() + vec[1] );
240 Eigen::Matrix<double,2,1> deltaX;
245 return std::sqrt( deltaX.multiply_HtCH_scalar( (other.
cov + this->cov).inverse() ) );
252 Eigen::Matrix<double,2,1> deltaX;
257 return std::sqrt( deltaX.multiply_HtCH_scalar( this->cov.inverse() ) );
#define CLASS_ID(class_name)
Access to runtime class ID for a defined class name.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
A numeric matrix of compile-time fixed size.
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
A class used to store a 2D point.
A gaussian distribution for 2D points.
CPoint2DPDFGaussian()
Default constructor.
void changeCoordinatesReference(const CPose3D &newReferenceBase) MRPT_OVERRIDE
this = p (+) this.
void bayesianFusion(const CPoint2DPDFGaussian &p1, const CPoint2DPDFGaussian &p2)
Bayesian fusion of two points gauss.
double productIntegralWith(const CPoint2DPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
CPoint2D mean
The mean value.
double mahalanobisDistanceTo(const CPoint2DPDFGaussian &other) const
Returns the Mahalanobis distance from this PDF to another PDF, that is, it's evaluation at (0,...
void drawSingleSample(CPoint2D &outSample) const MRPT_OVERRIDE
Draw a sample from the pdf.
mrpt::math::CMatrixDouble22 cov
The 2x2 covariance matrix.
void copyFrom(const CPoint2DPDF &o) MRPT_OVERRIDE
Copy operator, translating if necesary (for example, between particles and gaussian representations)
void readFromStream(mrpt::utils::CStream &in, int version)
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
double mahalanobisDistanceToPoint(const double x, const double y) const
Returns the Mahalanobis distance from this PDF to some point.
void saveToTextFile(const std::string &file) const MRPT_OVERRIDE
Save PDF's particles to a text file, containing the 2D pose in the first line, then the covariance ma...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const
Introduces a pure virtual method responsible for writing to a CStream.
double productIntegralNormalizedWith(const CPoint2DPDFGaussian &p) const
Computes the "correspondence likelihood" of this PDF with another one: This is implemented as the int...
Declares a class that represents a Probability Distribution function (PDF) of a 2D point (x,...
virtual const mrpt::utils::TRuntimeClassId * GetRuntimeClass() const
Returns information about the class of an object in runtime.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
void getRotationMatrix(mrpt::math::CMatrixDouble33 &ROT) const
Get the 3x3 rotation matrix.
double x() const
Common members of all points & poses classes.
void drawGaussianMultivariate(std::vector< T > &out_result, const mrpt::math::CMatrixTemplateNumeric< T > &cov, const std::vector< T > *mean=NULL)
Generate multidimensional random samples according to a given covariance matrix.
virtual void getCovarianceAndMean(mrpt::math::CMatrixFixedNumeric< double, STATE_LEN, STATE_LEN > &cov, TDATA &mean_point) const =0
Returns an estimate of the pose covariance matrix (STATE_LENxSTATE_LEN cov matrix) and the mean,...
static const size_t state_length
The length of the variable, for example, 3 for a 3D point, 6 for a 3D pose (x y z yaw pitch roll).
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
GLsizei const GLchar ** string
int BASE_IMPEXP fprintf(FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
An OS-independent version of fprintf.
FILE BASE_IMPEXP * fopen(const char *fileName, const char *mode) MRPT_NO_THROWS
An OS-independent version of fopen.
int BASE_IMPEXP void BASE_IMPEXP fclose(FILE *f)
An OS-independent version of fclose.
This file implements matrix/vector text and binary serialization.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
#define THROW_EXCEPTION(msg)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
This base provides a set of functions for maths stuff.
CMatrixFixedNumeric< double, 2, 1 > CMatrixDouble21
Eigen::Matrix< typename MATRIX::Scalar, MATRIX::ColsAtCompileTime, MATRIX::ColsAtCompileTime > cov(const MATRIX &v)
Computes the covariance matrix from a list of samples in an NxM matrix, where each row is a sample,...
T square(const T x)
Inline function for the square of a number.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
A namespace of pseudo-random numbers genrators of diferent distributions.
BASE_IMPEXP CRandomGenerator randomGenerator
A static instance of a CRandomGenerator class, for use in single-thread applications.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...