libalmath  2.1.4.13
 All Classes Namespaces Functions Variables Typedefs Groups Pages
alvelocity6d.h
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_ALVELOCITY6D_H_
10 #define _LIBALMATH_ALMATH_TYPES_ALVELOCITY6D_H_
11 
12 #include <vector>
13 
14 namespace AL {
15 namespace Math {
16 
17 
24 struct Velocity6D {
26  float xd;
28  float yd;
30  float zd;
32  float wxd;
34  float wyd;
36  float wzd;
37 
40 
59  Velocity6D();
61 
64 
83  explicit Velocity6D(float pInit);
87 
90 
109  Velocity6D(
117  float pXd,
118  float pYd,
119  float pZd,
120  float pWxd,
121  float pWyd,
122  float pWzd);
123 
126 
145  Velocity6D(const std::vector<float>& pFloats);
152 
157  inline Velocity6D operator+ (const Velocity6D& pVel2) const
158  {
159  return Velocity6D(
160  xd + pVel2.xd,
161  yd + pVel2.yd,
162  zd + pVel2.zd,
163  wxd + pVel2.wxd,
164  wyd + pVel2.wyd,
165  wzd + pVel2.wzd);
166  }
167 
172  inline Velocity6D operator- (const Velocity6D& pVel2) const
173  {
174  return Velocity6D(
175  xd - pVel2.xd,
176  yd - pVel2.yd,
177  zd - pVel2.zd,
178  wxd - pVel2.wxd,
179  wyd - pVel2.wyd,
180  wzd - pVel2.wzd);
181  }
182 
186  inline Velocity6D operator+ (void) const
187  {
188  return *this;
189  }
190 
194  inline Velocity6D operator- () const
195  {
196  return Velocity6D(-xd, -yd, -zd, -wxd, -wyd, -wzd);
197  }
198 
203  inline Velocity6D operator* (const float pVal) const
204  {
205  return Velocity6D(
206  xd*pVal,
207  yd*pVal,
208  zd*pVal,
209  wxd*pVal,
210  wyd*pVal,
211  wzd*pVal);
212  }
213 
218  Velocity6D operator/ (const float pVal) const;
219 
224  bool operator== (const Velocity6D& pVel2) const;
225 
230  bool operator!= (const Velocity6D& pVel2) const;
231 
236  Velocity6D& operator*= (const float pVal);
237 
242  Velocity6D& operator/= (const float pVal);
243 
254  bool isNear(
255  const Velocity6D& pVel2,
256  const float& pEpsilon=0.0001f) const;
257 
266  float norm() const;
267 
276  Velocity6D normalize() const;
277 
281  void toVector(std::vector<float>& pReturnVector) const;
282  std::vector<float> toVector(void) const;
283 }; // end struct
284 
290 Velocity6D operator* (
291  const float pVal,
292  const Velocity6D& pVel);
293 
304 float norm(const Velocity6D& pVel);
305 
316 Velocity6D normalize(const Velocity6D& pVel);
317 
318 } // end namespace Math
319 } // end namespace AL
320 #endif // _LIBALMATH_ALMATH_TYPES_ALVELOCITY6D_H_
bool operator!=(const Velocity6D &pVel2) const
Overloading of operator != for Velocity6D.
bool isNear(const Velocity6D &pVel2, const float &pEpsilon=0.0001f) const
Check if the actual Velocity6D is Near the one given in argument.
float norm() const
Compute the norm of the actual Velocity6D:
Velocity6D operator-() const
Overloading of operator - for Velocity6D.
Definition: alvelocity6d.h:194
Velocity6D operator/(const float pVal) const
Overloading of operator / for Velocity6D.
Create and play with a Velocity6D.
Definition: alvelocity6d.h:24
Position3D operator*(const Rotation &pRot, const Position3D &pPos)
Overloading of operator * between Rotation and Position3D:
Velocity6D normalize(const Velocity6D &pVel)
Normalize a Velocity6D:
Velocity6D()
Create a Velocity6D initialize with 0.0f.
Velocity6D operator*(const float pVal) const
Overloading of operator * for Velocity6D.
Definition: alvelocity6d.h:203
Velocity6D & operator*=(const float pVal)
Overloading of operator *= for Velocity6D.
Velocity6D operator+(void) const
Overloading of operator + for Velocity6D.
Definition: alvelocity6d.h:186
float norm(const Velocity6D &pVel)
Compute the norm of a Velocity6D:
Velocity6D & operator/=(const float pVal)
Overloading of operator /= for Velocity6D.
Velocity6D normalize() const
Normalize the actual Velocity6D:
bool operator==(const Velocity6D &pVel2) const
Overloading of operator == for Velocity6D.