libalmath  2.4.3.28-r2
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
alvelocity6d.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_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 
288  void writeToVector(std::vector<float>::iterator& pIt) const;
289 }; // end struct
290 
296 Velocity6D operator* (
297  const float pVal,
298  const Velocity6D& pVel);
299 
310 float norm(const Velocity6D& pVel);
311 
322 Velocity6D normalize(const Velocity6D& pVel);
323 
324 } // end namespace Math
325 } // end namespace AL
326 #endif // _LIBALMATH_ALMATH_TYPES_ALVELOCITY6D_H_
Velocity6D operator+(void) const
Overloading of operator + for Velocity6D.
Definition: alvelocity6d.h:186
Create and play with a Velocity6D.
Definition: alvelocity6d.h:24
float norm(const Position2D &pPos)
Compute the norm of a Position2D.
Velocity6D & operator*=(const float pVal)
Overloading of operator *= for Velocity6D.
Velocity6D normalize() const
Normalize the actual Velocity6D:
Velocity6D & operator/=(const float pVal)
Overloading of operator /= for Velocity6D.
Position2D normalize(const Position2D &pPos)
Normalize a Position2D.
std::vector< float > toVector(void) const
float norm() const
Compute the norm of the actual Velocity6D:
Velocity6D operator*(const float pVal) const
Overloading of operator * for Velocity6D.
Definition: alvelocity6d.h:203
Velocity6D()
Create a Velocity6D initialize with 0.0f.
bool isNear(const Velocity6D &pVel2, const float &pEpsilon=0.0001f) const
Check if the actual Velocity6D is Near the one given in argument.
bool operator==(const Velocity6D &pVel2) const
Overloading of operator == for Velocity6D.
Velocity6D operator-() const
Overloading of operator - for Velocity6D.
Definition: alvelocity6d.h:194
void writeToVector(std::vector< float >::iterator &pIt) const
Write [xd, yd, zd, wxd, wyd, wzd] in the vector and update the iterator. It is assumed the vector has...
Velocity6D operator/(const float pVal) const
Overloading of operator / for Velocity6D.
bool operator!=(const Velocity6D &pVel2) const
Overloading of operator != for Velocity6D.
Position3D operator*(const Rotation &pRot, const Position3D &pPos)
Overloading of operator * between Rotation and Position3D: