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



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST