libalmath  2.4.3.28-r2
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
alrotation3d.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the COPYING file.
5  */
6 
7 
8 #pragma once
9 #ifndef _LIBALMATH_ALMATH_TYPES_ALROTATION3D_H_
10 #define _LIBALMATH_ALMATH_TYPES_ALROTATION3D_H_
11 
12 #include <vector>
13 
14 namespace AL {
15  namespace Math {
16 
21  struct Rotation3D {
23  float wx;
25  float wy;
27  float wz;
28 
31 
44  Rotation3D();
46 
51 
64  explicit Rotation3D(float pInit);
66 
69 
82  Rotation3D(
87  float pWx,
88  float pWy,
89  float pWz);
90 
93 
106  Rotation3D (const std::vector<float>& pFloats);
112 
117  inline Rotation3D operator+ (const Rotation3D& pRot2) const
118  {
119  return Rotation3D(
120  wx + pRot2.wx,
121  wy + pRot2.wy,
122  wz + pRot2.wz);
123  }
124 
129  inline Rotation3D operator- (const Rotation3D& pRot2) const
130  {
131  return Rotation3D(
132  wx - pRot2.wx,
133  wy - pRot2.wy,
134  wz - pRot2.wz);
135  }
136 
141  Rotation3D& operator+= (const Rotation3D& pRot2);
142 
147  Rotation3D& operator-= (const Rotation3D& pRot2);
148 
153  bool operator== (const Rotation3D& pRot2) const;
154 
159  bool operator!= (const Rotation3D& pRot2) const;
160 
165  inline Rotation3D operator* (const float pVal) const
166  {
167  return Rotation3D(wx*pVal, wy*pVal, wz*pVal);
168  }
169 
174  Rotation3D operator/ (const float pVal) const;
175 
180  Rotation3D& operator*= (const float pVal);
181 
186  Rotation3D& operator/= (const float pVal);
187 
198  bool isNear(
199  const Rotation3D& pRot2,
200  const float& pEpsilon=0.0001f) const;
201 
210  float norm() const;
211 
215  void toVector(std::vector<float>& pReturnVector) const;
216  std::vector<float> toVector(void) const;
217  };
218 
229  float norm(const Rotation3D& pRot);
230 
231  } // end namespace Math
232 } // end namespace AL
233 #endif // _LIBALMATH_ALMATH_TYPES_ALROTATION3D_H_
float norm() const
Compute the norm of the actual Position6D:
Rotation3D & operator-=(const Rotation3D &pRot2)
Overloading of operator -= for Rotation3D.
bool operator!=(const Rotation3D &pRot2) const
Overloading of operator != for Rotation3D.
Rotation3D operator-(const Rotation3D &pRot2) const
Overloading of operator - for Rotation3D.
Definition: alrotation3d.h:129
float norm(const Position2D &pPos)
Compute the norm of a Position2D.
bool isNear(const Rotation3D &pRot2, const float &pEpsilon=0.0001f) const
Check if the actual Rotation3D is near the one given in argument.
A Rotation3D give 3 composed angles in radians.
Definition: alrotation3d.h:21
Rotation3D & operator*=(const float pVal)
Overloading of operator *= for Rotation3D.
Rotation3D operator/(const float pVal) const
Overloading of operator / for Rotation3D.
std::vector< float > toVector(void) const
Rotation3D & operator/=(const float pVal)
Overloading of operator /= for Rotation3D.
bool operator==(const Rotation3D &pRot2) const
Overloading of operator == for Rotation3D.
Rotation3D & operator+=(const Rotation3D &pRot2)
Overloading of operator += for Rotation3D.
Rotation3D operator*(const float pVal) const
Overloading of operator * for Rotation3D.
Definition: alrotation3d.h:165
Rotation3D()
Create a Rotation3D initialized with 0.0f.
Rotation3D operator+(const Rotation3D &pRot2) const
Overloading of operator + for Rotation3D.
Definition: alrotation3d.h:117