libalmath  1.14
 All Classes Namespaces Functions Variables Typedefs Groups Pages
alvelocity3d.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_ALVELOCITY3D_H_
10 #define _LIBALMATH_ALMATH_TYPES_ALVELOCITY3D_H_
11 
12 #include <vector>
13 
14 namespace AL {
15  namespace Math {
16 
23  struct Velocity3D {
25  float xd;
27  float yd;
29  float zd;
30 
33 
46 
47  Velocity3D();
48 
51 
64 
65 
66 
67  explicit Velocity3D(float pInit);
68 
71 
84 
85 
86 
87 
88  Velocity3D(
89  float pXd,
90  float pYd,
91  float pZd);
92 
95 
108 
109 
110 
111 
112 
113  Velocity3D(const std::vector<float>& pFloats);
114 
119  Velocity3D operator+ (const Velocity3D& pVel2) const;
120 
125  Velocity3D operator- (const Velocity3D& pVel2) const;
126 
130  Velocity3D operator+ () const;
131 
135  Velocity3D operator- () const;
136 
141  Velocity3D& operator+= (const Velocity3D& pVel2);
142 
147  Velocity3D& operator-= (const Velocity3D& pVel2);
148 
153  bool operator== (const Velocity3D& pVel2) const;
154 
159  bool operator!= (const Velocity3D& pVel2) const;
160 
165  Velocity3D operator* (const float pVal) const;
166 
171  Velocity3D operator/ (const float pVal) const;
172 
177  Velocity3D& operator*= (const float pVal);
178 
183  Velocity3D& operator/= (const float pVal);
184 
195  bool isNear(
196  const Velocity3D& pVel2,
197  const float& pEpsilon=0.0001f) const;
198 
199 
208  float norm () const;
209 
218  Velocity3D normalize() const;
219 
223  std::vector<float> toVector() const;
224  };
225 
227  const float pM,
228  const Velocity3D& pVel1);
229 
240  float norm (const Velocity3D& pVel);
241 
252  Velocity3D normalize(const Velocity3D& pVel);
253 
254  } // end namespace Math
255 } // end namespace AL
256 #endif // _LIBALMATH_ALMATH_TYPES_ALVELOCITY3D_H_