MRPT  2.0.1
point_poses2vectors.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <cstddef> // size_t
12 #include <type_traits> // enable_if_t
13 
14 namespace mrpt::math
15 {
16 struct TPoseOrPoint;
17 
18 /** \name Container initializer from pose classes
19  * @{
20  */
21 
22 /** Conversion of poses to MRPT containers (vector/matrix) */
23 template <class CONTAINER, class POINT_OR_POSE>
24 CONTAINER& containerFromPoseOrPoint(CONTAINER& C, const POINT_OR_POSE& p)
25 {
26  const size_t DIMS = POINT_OR_POSE::static_size;
27  C.resize(DIMS, 1);
28  for (size_t i = 0; i < DIMS; i++)
29  C(i, 0) = static_cast<typename CONTAINER::Scalar>(p[i]);
30  return C;
31 }
32 
33 #define MRPT_MATRIX_CONSTRUCTORS_FROM_POSES(_CLASS_) \
34  template < \
35  class TPOSE, typename = std::enable_if_t< \
36  std::is_base_of_v<mrpt::math::TPoseOrPoint, TPOSE>>> \
37  explicit inline _CLASS_(const TPOSE& p) \
38  { \
39  mrpt::math::containerFromPoseOrPoint(*this, p); \
40  } \
41  template <class CPOSE, int = CPOSE::is_3D_val> \
42  explicit inline _CLASS_(const CPOSE& p) \
43  { \
44  mrpt::math::containerFromPoseOrPoint(*this, p); \
45  }
46 
47 /** @} */
48 
49 } // namespace mrpt::math
double Scalar
Definition: KmUtils.h:43
CONTAINER & containerFromPoseOrPoint(CONTAINER &C, const POINT_OR_POSE &p)
Conversion of poses to MRPT containers (vector/matrix)
This base provides a set of functions for maths stuff.



Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020