Debian Codegraph @

3rdparty/xspublic/xstypes/xssdidata.h

raw
1
2 // Copyright (c) 2003-2019 Xsens Technologies B.V. or subsidiaries worldwide.
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without modification,
6 // are permitted provided that the following conditions are met:
7 //
8 // 1. Redistributions of source code must retain the above copyright notice,
9 // this list of conditions, and the following disclaimer.
10 //
11 // 2. Redistributions in binary form must reproduce the above copyright notice,
12 // this list of conditions, and the following disclaimer in the documentation
13 // and/or other materials provided with the distribution.
14 //
15 // 3. Neither the names of the copyright holders nor the names of their contributors
16 // may be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22 // THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
24 // OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY OR
26 // TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.THE LAWS OF THE NETHERLANDS
28 // SHALL BE EXCLUSIVELY APPLICABLE AND ANY DISPUTES SHALL BE FINALLY SETTLED UNDER THE RULES
29 // OF ARBITRATION OF THE INTERNATIONAL CHAMBER OF COMMERCE IN THE HAGUE BY ONE OR MORE
30 // ARBITRATORS APPOINTED IN ACCORDANCE WITH SAID RULES.
31 //
32
33 #ifndef XSSDIDATA_H
34 #define XSSDIDATA_H
35
36 #include "xstypesconfig.h"
37 #include "xsvector3.h"
38 #include "xsquaternion.h"
39
40 struct XsSdiData;
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 #ifndef __cplusplus
46 #define XSSDIDATA_INITIALIZER {XSQUATERNION_INITIALIZER, XSVECTOR3_INITIALIZER}
47 #endif
48
49 XSTYPES_DLL_API void XsSdiData_construct(struct XsSdiData* thisPtr, const XsReal* orientationIncrement, const XsReal* velocityIncrement);
50 XSTYPES_DLL_API void XsSdiData_destruct(struct XsSdiData* thisPtr);
51
52 #ifdef __cplusplus
53 } // extern "C"
54 #endif
55
56 struct XsSdiData
57 {
58 #ifdef __cplusplus
59 //! \brief Construct an empty object
60 inline XsSdiData()
61 {
62 }
63
64 //! \brief Construct an initialized object
65 inline XsSdiData(const XsQuaternion& dq, const XsVector& dv)
66 : m_orientationIncrement(dq)
67 , m_velocityIncrement(dv)
68 {
69 }
70
71 //! \brief Copy constructor
72 inline XsSdiData(const XsSdiData& other)
73 : m_orientationIncrement(other.m_orientationIncrement)
74 , m_velocityIncrement(other.m_velocityIncrement)
75 {
76 }
77
78 //! \brief Assignment operator
79 inline const XsSdiData& operator=(const XsSdiData& other)
80 {
81 if (this != &other)
82 {
83 m_orientationIncrement = other.m_orientationIncrement;
84 m_velocityIncrement = other.m_velocityIncrement;
85 }
86 return *this;
87 }
88
89 //! \brief Clear the object so it contains unity data
90 inline void zero()
91 {
92 m_orientationIncrement = XsQuaternion::identity();
93 m_velocityIncrement.zero();
94 }
95
96 //! \brief Returns the contained orientation increment
97 inline const XsQuaternion& orientationIncrement() const
98 {
99 return m_orientationIncrement;
100 }
101
102 //! \brief Update the contained orientation increment
103 inline void setOrientationIncrement(const XsQuaternion& dq)
104 {
105 m_orientationIncrement = dq;
106 }
107
108 //! \brief Returns the contained velocity increment
109 inline const XsVector3& velocityIncrement() const
110 {
111 return m_velocityIncrement;
112 }
113
114 //! \brief Update the contained velocity increment
115 inline void setVelocityIncrement(const XsVector& dv)
116 {
117 m_velocityIncrement = dv;
118 }
119
120 /*! \brief Returns true if all fields of this and \a other are exactly identical */
121 inline bool operator == (const XsSdiData& other) const
122 {
123 return m_orientationIncrement == other.m_orientationIncrement &&
124 m_velocityIncrement == other.m_velocityIncrement;
125 }
126
127 private:
128 #endif
129
130 XsQuaternion m_orientationIncrement; //!< The orientation increment
131 XsVector3 m_velocityIncrement; //!< The velocity increment
132 };
133
134 typedef struct XsSdiData XsSdiData;
135
136 #endif // file guard