vector3.cpp
Go to the documentation of this file.
1 
7 #include "vector3.h"
8 #include "quaternion.h"
9 
10 namespace argos {
11 
12  /****************************************/
13  /****************************************/
14 
15  const CVector3 CVector3::X(1.0, 0.0, 0.0);
16  const CVector3 CVector3::Y(0.0, 1.0, 0.0);
17  const CVector3 CVector3::Z(0.0, 0.0, 1.0);
18  const CVector3 CVector3::ZERO;
19 
20  /****************************************/
21  /****************************************/
22 
23  CVector3& CVector3::Rotate(const CQuaternion& c_quaternion) {
24  CQuaternion cResult;
25  cResult = c_quaternion;
26  cResult *= CQuaternion(0.0f, m_fX, m_fY, m_fZ);
27  cResult *= c_quaternion.Inverse();
28  m_fX = cResult.GetX();
29  m_fY = cResult.GetY();
30  m_fZ = cResult.GetZ();
31  return *this;
32  }
33 
34  /****************************************/
35  /****************************************/
36 
37 }
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
CQuaternion Inverse() const
Definition: quaternion.h:98
Real GetX() const
Definition: quaternion.h:53
Real GetZ() const
Definition: quaternion.h:61
Real GetY() const
Definition: quaternion.h:57
A 3D vector class.
Definition: vector3.h:31
static const CVector3 Y
The y axis.
Definition: vector3.h:39
CVector3 & Rotate(const CQuaternion &c_quaternion)
Rotates this vector by the given quaternion.
Definition: vector3.cpp:23
static const CVector3 X
The x axis.
Definition: vector3.h:36
static const CVector3 Z
The z axis.
Definition: vector3.h:42
static const CVector3 ZERO
The zero vector (0,0,0)
Definition: vector3.h:45