libalmath  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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 #include <almath/api.h>
14 
15 namespace AL {
16  namespace Math {
17 
22  struct ALMATH_API Rotation3D {
24  float wx;
26  float wy;
28  float wz;
29 
32 
45  Rotation3D();
47 
52 
65  explicit Rotation3D(float pInit);
67 
70 
83  Rotation3D(
88  float pWx,
89  float pWy,
90  float pWz);
91 
94 
107  Rotation3D (const std::vector<float>& pFloats);
113 
118  inline Rotation3D operator+ (const Rotation3D& pRot2) const
119  {
120  return Rotation3D(
121  wx + pRot2.wx,
122  wy + pRot2.wy,
123  wz + pRot2.wz);
124  }
125 
130  inline Rotation3D operator- (const Rotation3D& pRot2) const
131  {
132  return Rotation3D(
133  wx - pRot2.wx,
134  wy - pRot2.wy,
135  wz - pRot2.wz);
136  }
137 
142  Rotation3D& operator+= (const Rotation3D& pRot2);
143 
148  Rotation3D& operator-= (const Rotation3D& pRot2);
149 
154  bool operator== (const Rotation3D& pRot2) const;
155 
160  bool operator!= (const Rotation3D& pRot2) const;
161 
166  inline Rotation3D operator* (const float pVal) const
167  {
168  return Rotation3D(wx*pVal, wy*pVal, wz*pVal);
169  }
170 
175  Rotation3D operator/ (const float pVal) const;
176 
181  Rotation3D& operator*= (const float pVal);
182 
187  Rotation3D& operator/= (const float pVal);
188 
199  bool isNear(
200  const Rotation3D& pRot2,
201  const float& pEpsilon=0.0001f) const;
202 
211  float norm() const;
212 
216  void toVector(std::vector<float>& pReturnVector) const;
217  std::vector<float> toVector(void) const;
218  };
219 
230  ALMATH_API float norm(const Rotation3D& pRot);
231 
232  } // end namespace Math
233 } // end namespace AL
234 #endif // _LIBALMATH_ALMATH_TYPES_ALROTATION3D_H_
BodyMass< T > operator+(const BodyMass< T > &lhs, const BodyMass< T > &rhs)
Definition: bodymass.h:111
A Rotation3D give 3 composed angles in radians.
Definition: alrotation3d.h:22
bool isNear(const Transform &lhs, const Transform &rhs, double epsilon)
Definition: qigeometry.h:111
bool operator!=(const Pose &lhs, const Pose &rhs)
Definition: urdf.h:340
ALMATH_API float norm(const Position2D &pPos)
Compute the norm of a Position2D.
bool operator==(const BodyMass< T > &lhs, const BodyMass< T > &rhs)
Definition: bodymass.h:79
ALMATH_API Position3D operator*(const Rotation &pRot, const Position3D &pPos)
Overloading of operator * between Rotation and Position3D: