libalmath
1.12
|
00001 /* 00002 ** Author(s): 00003 ** - Chris Kilner 00004 ** - Cyrille Collette 00005 ** - David Gouaillier 00006 ** 00007 ** Copyright (C) 2011 Aldebaran Robotics 00008 */ 00009 00010 00011 #pragma once 00012 #ifndef _LIBALMATH_ALMATH_TYPES_ALVELOCITY3D_H_ 00013 #define _LIBALMATH_ALMATH_TYPES_ALVELOCITY3D_H_ 00014 00015 #include <vector> 00016 00017 namespace AL { 00018 namespace Math { 00019 00026 struct Velocity3D { 00028 float xd; 00030 float yd; 00032 float zd; 00033 00036 00049 00050 Velocity3D(); 00051 00054 00067 00068 00069 00070 explicit Velocity3D(float pInit); 00071 00074 00087 00088 00089 00090 00091 Velocity3D( 00092 float pXd, 00093 float pYd, 00094 float pZd); 00095 00098 00111 00112 00113 00114 00115 00116 Velocity3D(const std::vector<float>& pFloats); 00117 00122 Velocity3D operator+ (const Velocity3D& pVel2) const; 00123 00128 Velocity3D operator- (const Velocity3D& pVel2) const; 00129 00133 Velocity3D operator+ () const; 00134 00138 Velocity3D operator- () const; 00139 00144 Velocity3D& operator+= (const Velocity3D& pVel2); 00145 00150 Velocity3D& operator-= (const Velocity3D& pVel2); 00151 00156 bool operator== (const Velocity3D& pVel2) const; 00157 00162 bool operator!= (const Velocity3D& pVel2) const; 00163 00168 Velocity3D operator* (const float pVal) const; 00169 00174 Velocity3D operator/ (const float pVal) const; 00175 00180 Velocity3D& operator*= (const float pVal); 00181 00186 Velocity3D& operator/= (const float pVal); 00187 00198 bool isNear( 00199 const Velocity3D& pVel2, 00200 const float& pEpsilon=0.0001f) const; 00201 00202 00211 float norm () const; 00212 00221 Velocity3D normalize() const; 00222 00226 std::vector<float> toVector() const; 00227 }; 00228 00229 Velocity3D operator* ( 00230 const float pM, 00231 const Velocity3D& pVel1); 00232 00243 float norm (const Velocity3D& pVel); 00244 00255 Velocity3D normalize(const Velocity3D& pVel); 00256 00257 } // end namespace Math 00258 } // end namespace AL 00259 #endif // _LIBALMATH_ALMATH_TYPES_ALVELOCITY3D_H_