38 #ifndef SBG_MATRIX_3_H 39 #define SBG_MATRIX_3_H 46 #include "sbg_driver/SbgEkfQuat.h" 47 #include "sbg_driver/SbgEkfEuler.h" 77 m_data[0] =
static_cast<T
>(0.0);
78 m_data[1] =
static_cast<T
>(0.0);
79 m_data[2] =
static_cast<T
>(0.0);
80 m_data[3] =
static_cast<T
>(0.0);
81 m_data[4] =
static_cast<T
>(0.0);
82 m_data[5] =
static_cast<T
>(0.0);
83 m_data[6] =
static_cast<T
>(0.0);
84 m_data[7] =
static_cast<T
>(0.0);
85 m_data[8] =
static_cast<T
>(0.0);
101 SbgMatrix3(T value00, T value01, T value02, T value10, T value11, T value12, T value20, T value21, T value22)
122 assert(array_size == 9);
124 m_data[0] = p_raw_data[0];
125 m_data[1] = p_raw_data[1];
126 m_data[2] = p_raw_data[2];
127 m_data[3] = p_raw_data[3];
128 m_data[4] = p_raw_data[4];
129 m_data[5] = p_raw_data[5];
130 m_data[6] = p_raw_data[6];
131 m_data[7] = p_raw_data[7];
132 m_data[8] = p_raw_data[8];
152 assert(i * 3 + j < 9);
154 return m_data[i * 3 + j];
164 return static_cast<const T*
>(m_data.data());
169 T x = m_data[0] * vect(0) + m_data[1] * vect(1) + m_data[2] * vect(2);
170 T y = m_data[3] * vect(0) + m_data[4] * vect(1) + m_data[5] * vect(2);
171 T z = m_data[6] * vect(0) + m_data[7] * vect(1) + m_data[8] * vect(2);
179 m_data[1] = m_data[3];
183 m_data[2] = m_data[6];
187 m_data[5] = m_data[7];
201 float cr = cosf(euler(0));
202 float sr = sinf(euler(0));
203 float cp = cosf(euler(1));
204 float sp = sinf(euler(1));
205 float cy = cosf(euler(2));
206 float sy = sinf(euler(2));
212 m_data[1] = (sr * sp * cy) - (cr * sy);
213 m_data[4] = (sr * sp * sy) + (cr * cy);
216 m_data[2] = (cr * sp * cy) + (sy * sr);
217 m_data[5] = (cr * sp * sy) - (sr * cy);
230 void makeDcm(
float w,
float x,
float y,
float z)
239 m_data[0] = (2 * powf(w, 2)) + (2 * powf(x, 2)) - 1;
240 m_data[3] = (2 * xy) + (2 * wz);
241 m_data[6] = (2 * xz) - (2 * wy);
243 m_data[1] = (2 * xy) - (2 * wz);
244 m_data[4] = (2 * powf(w, 2)) + (2 * powf(y, 2)) - 1;
245 m_data[7] = (2 * yz) + (2 * wx);
247 m_data[2] = (2 * wy) + (2 * xz);
248 m_data[5] = (2 * yz) - (2 * wx);
249 m_data[8] = (2 * powf(w, 2)) + (2 * powf(z, 2)) - 1;
260 #endif // SBG_MATRIX_3_H
const SbgVector3< T > operator*(const SbgVector3< T > &vect) const
SbgMatrix3< double > SbgMatrix3d
std::array< T, 9 > m_data
void makeDcm(float w, float x, float y, float z)
void makeDcm(const SbgVector3f &euler)
SbgMatrix3(T value00, T value01, T value02, T value10, T value11, T value12, T value20, T value21, T value22)
Header file that contains all common definitions.
Handle a three components vector.
void swap(scoped_ptr< T > &, scoped_ptr< T > &)
const T operator()(int i, int j) const
SbgMatrix3< float > SbgMatrix3f
const T * data(void) const
SbgMatrix3(const T *p_raw_data, size_t array_size)