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