MRPT  1.9.9
xseuler.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-2019, 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 #ifndef XSEULER_H
10 #define XSEULER_H
11 
12 #include "xsmath.h"
13 
14 #ifdef __cplusplus
15 extern "C"
16 {
17 #else
18 #define XSEULER_INITIALIZER \
19  { \
20  { \
21  { \
22  XsMath_zero, XsMath_zero, XsMath_zero \
23  } \
24  } \
25  }
26 #endif
27 
28  struct XsEuler;
29  struct XsQuaternion;
30  struct XsMatrix;
31 
32  XSTYPES_DLL_API void XsEuler_destruct(struct XsEuler* thisPtr);
33  XSTYPES_DLL_API int XsEuler_empty(const struct XsEuler* thisPtr);
35  struct XsEuler* thisPtr, const struct XsQuaternion* quat);
36 
37 #ifdef __cplusplus
38 } // extern "C"
39 #endif
40 
41 struct XsEuler
42 {
43 #ifdef __cplusplus
44  //! \brief Constructor that creates an Euler object with all angles 0
46  //! \brief Constructor that creates an Euler object the specified angles
47  inline XsEuler(XsReal x_, XsReal y_, XsReal z_) : m_x(x_), m_y(y_), m_z(z_)
48  {
49  }
50  //! \brief Constructor that creates an Euler object from \a other
51  inline XsEuler(const XsEuler& other)
52  : m_x(other.m_x), m_y(other.m_y), m_z(other.m_z)
53  {
54  }
55 
56  //! \brief \copybrief XsEuler_fromQuaternion
57  inline explicit XsEuler(const XsQuaternion& q)
58  {
59  XsEuler_fromQuaternion(this, &q);
60  }
61 
62  //! \brief Assigns the \a other XsEuler object to this one
63  inline XsEuler& operator=(const XsEuler& other)
64  {
65  m_x = other.m_x;
66  m_y = other.m_y;
67  m_z = other.m_z;
68  return *this;
69  }
70 
71  //! \brief Returns the \a index'th euler angle in the object
72  inline XsReal operator[](XsSize index) const
73  {
74  assert(index <= 2);
75  return m_data[index];
76  }
77 
78  //! \brief Returns a reference to the \a index'th euler angle in the object
79  inline XsReal& operator[](XsSize index)
80  {
81  assert(index <= 2);
82  return m_data[index];
83  }
84 
85  //! \brief Returns true if all angles in this object are zero
86  inline bool empty() const
87  {
88  return m_x == XsMath_zero && m_y == XsMath_zero && m_z == XsMath_zero;
89  }
90 
91  //! \brief Return a const pointer to the internal data
92  inline const XsReal* data() const { return m_data; }
93  //! \brief \copybrief XsEuler_fromQuaternion
94  inline XsEuler& fromQuaternion(const XsQuaternion& quat)
95  {
96  XsEuler_fromQuaternion(this, &quat);
97  return *this;
98  }
99 
100  /*! \brief Returns true if the values in \a other are exactly equal to this
101  */
102  inline bool operator==(const XsEuler& other) const
103  {
104  return m_roll == other.m_roll && m_pitch == other.m_pitch &&
105  m_yaw == other.m_yaw;
106  }
107 
108  /*! \brief Returns true if the values in \a other are different from this
109  */
110  inline bool operator!=(const XsEuler& other) const
111  {
112  return m_roll != other.m_roll || m_pitch != other.m_pitch ||
113  m_yaw != other.m_yaw;
114  }
115 
116  //! \brief Returns the roll or x value
117  inline XsReal roll() const { return m_roll; }
118  //! \brief Returns the pitch or y value
119  inline XsReal pitch() const { return m_pitch; }
120  //! \brief Returns the yaw or z value
121  inline XsReal yaw() const { return m_yaw; }
122  //! \brief Returns the x or roll value
123  inline XsReal x() const { return m_x; }
124  //! \brief Returns the y or pitch value
125  inline XsReal y() const { return m_y; }
126  //! \brief Returns the z or yaw value
127  inline XsReal z() const { return m_z; }
128 
129  private:
130 #endif
131 
132  union {
133  struct
134  {
135  /** Stores the x component of the euler triplet */
137  /** Stores the y component of the euler triplet */
139  /** Stores the z component of the euler triplet */
141  };
142  struct
143  {
144  /** Stores the roll component of the euler triplet */
146  /** Stores the pitch component of the euler triplet */
148  /** Stores the yaw component of the euler triplet */
150  };
151  /** Stores the euler triplet in an array of three elements */
153  };
154 };
155 
156 typedef struct XsEuler XsEuler;
157 
158 #endif // file guard
XsReal m_z
Stores the z component of the euler triplet.
Definition: xseuler.h:140
GLdouble GLdouble z
Definition: glext.h:3879
XSTYPES_DLL_API const XsReal XsMath_zero
GLdouble GLdouble GLdouble GLdouble q
Definition: glext.h:3727
XsReal m_roll
Stores the roll component of the euler triplet.
Definition: xseuler.h:145
size_t XsSize
XsSize must be unsigned number!
Definition: xstypedefs.h:19
VALUE & operator[](const KEY &key)
Write/read via [i] operator, that creates an element if it didn&#39;t exist already.
Definition: ts_hash_map.h:193
XsReal m_data[3]
Stores the euler triplet in an array of three elements.
Definition: xseuler.h:152
GLuint index
Definition: glext.h:4068
bool empty() const
Definition: ts_hash_map.h:190
XsReal m_yaw
Stores the yaw component of the euler triplet.
Definition: xseuler.h:149
bool operator==(const mrpt::img::TCamera &a, const mrpt::img::TCamera &b)
Definition: TCamera.cpp:202
XSTYPES_DLL_API void XsEuler_destruct(struct XsEuler *thisPtr)
#define XSTYPES_DLL_API
Definition: xstypesconfig.h:9
XSTYPES_DLL_API void XsEuler_fromQuaternion(struct XsEuler *thisPtr, const struct XsQuaternion *quat)
double XsReal
Defines the floating point type used by the Xsens libraries.
Definition: xstypedefs.h:17
struct XsEuler XsEuler
Definition: xseuler.h:156
GLenum GLint GLint y
Definition: glext.h:3542
XsReal m_y
Stores the y component of the euler triplet.
Definition: xseuler.h:138
XSTYPES_DLL_API int XsEuler_empty(const struct XsEuler *thisPtr)
GLenum GLint x
Definition: glext.h:3542
XsReal m_pitch
Stores the pitch component of the euler triplet.
Definition: xseuler.h:147
bool operator!=(const mrpt::img::TCamera &a, const mrpt::img::TCamera &b)
Definition: TCamera.cpp:209
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:3550
XsReal m_x
Stores the x component of the euler triplet.
Definition: xseuler.h:136



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019