libalmath  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends 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 #include <almath/api.h>
14 
15 namespace AL {
16 namespace Math {
17 
18 
25 struct ALMATH_API Velocity6D {
27  float xd;
29  float yd;
31  float zd;
33  float wxd;
35  float wyd;
37  float wzd;
38 
41 
60  Velocity6D();
62 
65 
84  explicit Velocity6D(float pInit);
88 
91 
110  Velocity6D(
118  float pXd,
119  float pYd,
120  float pZd,
121  float pWxd,
122  float pWyd,
123  float pWzd);
124 
127 
146  Velocity6D(const std::vector<float>& pFloats);
153 
158  inline Velocity6D operator+ (const Velocity6D& pVel2) const
159  {
160  return Velocity6D(
161  xd + pVel2.xd,
162  yd + pVel2.yd,
163  zd + pVel2.zd,
164  wxd + pVel2.wxd,
165  wyd + pVel2.wyd,
166  wzd + pVel2.wzd);
167  }
168 
173  inline Velocity6D operator- (const Velocity6D& pVel2) const
174  {
175  return Velocity6D(
176  xd - pVel2.xd,
177  yd - pVel2.yd,
178  zd - pVel2.zd,
179  wxd - pVel2.wxd,
180  wyd - pVel2.wyd,
181  wzd - pVel2.wzd);
182  }
183 
187  inline Velocity6D operator+ (void) const
188  {
189  return *this;
190  }
191 
195  inline Velocity6D operator- () const
196  {
197  return Velocity6D(-xd, -yd, -zd, -wxd, -wyd, -wzd);
198  }
199 
204  inline Velocity6D operator* (const float pVal) const
205  {
206  return Velocity6D(
207  xd*pVal,
208  yd*pVal,
209  zd*pVal,
210  wxd*pVal,
211  wyd*pVal,
212  wzd*pVal);
213  }
214 
219  Velocity6D operator/ (const float pVal) const;
220 
225  bool operator== (const Velocity6D& pVel2) const;
226 
231  bool operator!= (const Velocity6D& pVel2) const;
232 
237  Velocity6D& operator*= (const float pVal);
238 
243  Velocity6D& operator/= (const float pVal);
244 
255  bool isNear(
256  const Velocity6D& pVel2,
257  const float& pEpsilon=0.0001f) const;
258 
267  float norm() const;
268 
277  Velocity6D normalize() const;
278 
282  void toVector(std::vector<float>& pReturnVector) const;
283  std::vector<float> toVector(void) const;
284 
289  void writeToVector(std::vector<float>::iterator& pIt) const;
290 }; // end struct
291 
297 ALMATH_API Velocity6D operator* (
298  const float pVal,
299  const Velocity6D& pVel);
300 
311 ALMATH_API float norm(const Velocity6D& pVel);
312 
323 ALMATH_API Velocity6D normalize(const Velocity6D& pVel);
324 
325 } // end namespace Math
326 } // end namespace AL
327 #endif // _LIBALMATH_ALMATH_TYPES_ALVELOCITY6D_H_
Create and play with a Velocity6D.
Definition: alvelocity6d.h:25
BodyMass< T > operator+(const BodyMass< T > &lhs, const BodyMass< T > &rhs)
Definition: bodymass.h:111
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 Position2D normalize(const Position2D &pPos)
Normalize a Position2D.
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: