transformationmatrix3.cpp
Go to the documentation of this file.
1 
10 
11 #include <argos3/core/utility/math/matrix/rotationmatrix3.h>
12 #include <argos3/core/utility/math/vector3.h>
13 
14 namespace argos {
15 
16  /****************************************/
17  /****************************************/
18 
19  void CTransformationMatrix3::SetFromComponents(const CRotationMatrix3& c_rotation, const CVector3& c_translation) {
20  /* Set the rotation elements */
21  SetRotationMatrix(c_rotation);
22  /* Set the translation elements */
23  SetTranslationVector(c_translation);
24  /* Set the bottom row elements */
25  m_pfValues[12] = 0.0f; m_pfValues[13] = 0.0f; m_pfValues[14] = 0.0f; m_pfValues[15] = 1.0f;
26  }
27 
28  /****************************************/
29  /****************************************/
30 
32  m_pfValues[ 0] = c_matrix.m_pfValues[ 0];
33  m_pfValues[ 1] = c_matrix.m_pfValues[ 1];
34  m_pfValues[ 2] = c_matrix.m_pfValues[ 2];
35  m_pfValues[ 3] = c_matrix.m_pfValues[ 3];
36  m_pfValues[ 4] = c_matrix.m_pfValues[ 4];
37  m_pfValues[ 5] = c_matrix.m_pfValues[ 5];
38  m_pfValues[ 6] = c_matrix.m_pfValues[ 6];
39  m_pfValues[ 7] = c_matrix.m_pfValues[ 7];
40  m_pfValues[ 8] = c_matrix.m_pfValues[ 8];
41  m_pfValues[ 9] = c_matrix.m_pfValues[ 9];
42  m_pfValues[10] = c_matrix.m_pfValues[10];
43  m_pfValues[11] = c_matrix.m_pfValues[11];
44  m_pfValues[12] = c_matrix.m_pfValues[12];
45  m_pfValues[13] = c_matrix.m_pfValues[13];
46  m_pfValues[14] = c_matrix.m_pfValues[14];
47  m_pfValues[15] = c_matrix.m_pfValues[15];
48  }
49 
50  /****************************************/
51  /****************************************/
52 
53  void CTransformationMatrix3::SetFromValues(Real f_value0, Real f_value1, Real f_value2, Real f_value3,
54  Real f_value4, Real f_value5, Real f_value6, Real f_value7,
55  Real f_value8, Real f_value9, Real f_value10, Real f_value11,
56  Real f_value12, Real f_value13, Real f_value14, Real f_value15) {
57  m_pfValues[ 0] = f_value0;
58  m_pfValues[ 1] = f_value1;
59  m_pfValues[ 2] = f_value2;
60  m_pfValues[ 3] = f_value3;
61  m_pfValues[ 4] = f_value4;
62  m_pfValues[ 5] = f_value5;
63  m_pfValues[ 6] = f_value6;
64  m_pfValues[ 7] = f_value7;
65  m_pfValues[ 8] = f_value8;
66  m_pfValues[ 9] = f_value9;
67  m_pfValues[10] = f_value10;
68  m_pfValues[11] = f_value11;
69  m_pfValues[12] = f_value12;
70  m_pfValues[13] = f_value13;
71  m_pfValues[14] = f_value14;
72  m_pfValues[15] = f_value15;
73  }
74 
75  /****************************************/
76  /****************************************/
77 
79  m_pfValues[0] = c_rotation.m_pfValues[0]; m_pfValues[1] = c_rotation.m_pfValues[1]; m_pfValues[ 2] = c_rotation.m_pfValues[2];
80  m_pfValues[4] = c_rotation.m_pfValues[3]; m_pfValues[5] = c_rotation.m_pfValues[4]; m_pfValues[ 6] = c_rotation.m_pfValues[5];
81  m_pfValues[8] = c_rotation.m_pfValues[6]; m_pfValues[9] = c_rotation.m_pfValues[7]; m_pfValues[10] = c_rotation.m_pfValues[8];
82  }
83 
84  /****************************************/
85  /****************************************/
86 
89  m_pfValues[4], m_pfValues[5], m_pfValues[6],
90  m_pfValues[8], m_pfValues[9], m_pfValues[10]);
91  }
92 
93  /****************************************/
94  /****************************************/
95 
97  m_pfValues[ 3] = c_translation.m_fX;
98  m_pfValues[ 7] = c_translation.m_fY;
99  m_pfValues[11] = c_translation.m_fZ;
100  }
101 
102  /****************************************/
103  /****************************************/
104 
106  return CVector3(m_pfValues[3], m_pfValues[7], m_pfValues[11]);
107  }
108 
109  /****************************************/
110  /****************************************/
111 
113  return CVector3(m_pfValues[0]*c_vector.m_fX + m_pfValues[1]*c_vector.m_fY + m_pfValues[2]*c_vector.m_fZ + m_pfValues[3],
114  m_pfValues[4]*c_vector.m_fX + m_pfValues[5]*c_vector.m_fY + m_pfValues[6]*c_vector.m_fZ + m_pfValues[7],
115  m_pfValues[8]*c_vector.m_fX + m_pfValues[9]*c_vector.m_fY + m_pfValues[10]*c_vector.m_fZ + m_pfValues[11]);
116  }
117 
118  /****************************************/
119  /****************************************/
120 
123  }
124 
125  /****************************************/
126  /****************************************/
127 }
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
Real m_pfValues[ROWS *COLS]
Definition: matrix.h:222
void SetRotationMatrix(const CRotationMatrix3 &c_rotation)
CRotationMatrix3 GetRotationMatrix() const
void SetFromMatrix(const CMatrix< 4, 4 > &c_matrix)
CVector3 operator*(const CVector3 &c_vector) const
void SetFromValues(Real f_value0, Real f_value1, Real f_value2, Real f_value3, Real f_value4, Real f_value5, Real f_value6, Real f_value7, Real f_value8, Real f_value9, Real f_value10, Real f_value11, Real f_value12, Real f_value13, Real f_value14, Real f_value15)
void SetFromComponents(const CRotationMatrix3 &c_rotation, const CVector3 &c_translation)
void SetTranslationVector(const CVector3 &c_translation)
A 3D vector class.
Definition: vector3.h:31