Main MRPT website > C++ reference for MRPT 1.5.3
CMatrix.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef CMATRIX_H
10 #define CMATRIX_H
11 
15 
16 namespace mrpt
17 {
18  namespace math
19  {
20  // This must be added to any CSerializable derived class:
21  // Note: instead of the standard "DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE", classes inheriting
22  // from templates need special nasty handling for MSVC DLL exports...
24  BASE_IMPEXP ::mrpt::utils::CStream& operator>>(mrpt::utils::CStream& in, CMatrixPtr &pObj);
25 
26  /** This class is a "CSerializable" wrapper for "CMatrixFloat".
27  * \note For a complete introduction to Matrices and vectors in MRPT, see: http://www.mrpt.org/Matrices_vectors_arrays_and_Linear_Algebra_MRPT_and_Eigen_classes
28  * \ingroup mrpt_base_grp
29  */
31  {
32  // This must be added to any CSerializable derived class:
33  DEFINE_SERIALIZABLE_CUSTOM_LINKAGE( CMatrix, void BASE_IMPEXP, static BASE_IMPEXP, virtual BASE_IMPEXP )
34 
35  public:
36  /** Constructor */
38  { }
39 
40  /** Constructor */
41  CMatrix(size_t row, size_t col) : CMatrixFloat(row,col)
42  { }
43 
44  /** Copy constructor
45  */
47  { }
48 
49  /** Copy constructor
50  */
52  {
53  *this = m.eval().cast<float>();
54  }
55 
56  /** Constructor from a TPose2D, which generates a 3x1 matrix \f$ [x y \phi]^T \f$ */
57  explicit CMatrix( const TPose2D &p);
58  /** Constructor from a mrpt::poses::CPose6D, which generates a 6x1 matrix \f$ [x y z yaw pitch roll]^T \f$ */
59  explicit CMatrix( const TPose3D &p);
60  /** Constructor from a TPoint2D, which generates a 2x1 matrix \f$ [x y]^T \f$ */
61  explicit CMatrix( const TPoint2D &p);
62  /** Constructor from a TPoint3D, which generates a 3x1 matrix \f$ [x y z]^T \f$ */
63  explicit CMatrix( const TPoint3D &p);
64 
65  /** Assignment operator for float matrixes
66  */
67  template <class OTHERMAT>
68  inline CMatrix & operator = (const OTHERMAT& m)
69  {
70  CMatrixFloat::operator =(m);
71  return *this;
72  }
73 
74  /*! Assignment operator from any other Eigen class */
75  template<typename OtherDerived>
76  inline CMatrix & operator= (const Eigen::MatrixBase <OtherDerived>& other) {
78  return *this;
79  }
80  /*! Constructor from any other Eigen class */
81  template<typename OtherDerived>
82  inline CMatrix(const Eigen::MatrixBase <OtherDerived>& other) : CMatrixTemplateNumeric<float>(other) { }
83 
84  }; // end of class definition
86 
87  } // End of namespace
88 } // End of namespace
89 
90 #endif
#define DEFINE_MRPT_OBJECT_PRE_CUSTOM_BASE_LINKAGE2(class_name, base_name, class_name_LINKAGE_)
This declaration must be inserted in all CObject classes definition, before the class declaration...
Definition: CObject.h:183
#define DEFINE_MRPT_OBJECT_POST_CUSTOM_BASE_LINKAGE2(class_name, base_name, class_name_LINKAGE_)
This declaration must be inserted in all CObject classes definition, after the class declaration...
Definition: CObject.h:188
The virtual base class which provides a unified interface for all persistent objects in MRPT...
Definition: CSerializable.h:39
#define DEFINE_SERIALIZABLE_CUSTOM_LINKAGE(class_name, _VOID_LINKAGE_, _STATIC_LINKAGE_, _VIRTUAL_LINKAGE_)
Like DEFINE_SERIALIZABLE, but for template classes that need the DLL imp/exp keyword in Windows...
CMatrix()
Constructor.
Definition: CMatrix.h:37
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:38
CMatrix(size_t row, size_t col)
Constructor.
Definition: CMatrix.h:41
CMatrix(const CMatrixTemplateNumeric< double > &m)
Copy constructor.
Definition: CMatrix.h:51
CMatrix(const Eigen::MatrixBase< OtherDerived > &other)
Definition: CMatrix.h:82
BASE_IMPEXP ::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CMatrixPtr &pObj)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Lightweight 3D pose (three spatial coordinates, plus three angular coordinates).
Lightweight 2D pose.
Lightweight 3D point.
This class is a "CSerializable" wrapper for "CMatrixFloat".
Definition: CMatrix.h:30
Lightweight 2D point.
CMatrix(const CMatrixFloat &m)
Copy constructor.
Definition: CMatrix.h:46



Page generated by Doxygen 1.8.13 for MRPT 1.5.3 at Mon Oct 30 10:27:08 UTC 2017