libalmath
1.14.5
|
00001 /* 00002 * Copyright (c) 2012 Aldebaran Robotics. All rights reserved. 00003 * Use of this source code is governed by a BSD-style license that can be 00004 * found in the COPYING file. 00005 */ 00006 00007 00008 #pragma once 00009 #ifndef _LIBALMATH_ALMATH_TYPES_ALVELOCITY3D_H_ 00010 #define _LIBALMATH_ALMATH_TYPES_ALVELOCITY3D_H_ 00011 00012 #include <vector> 00013 00014 namespace AL { 00015 namespace Math { 00016 00023 struct Velocity3D { 00025 float xd; 00027 float yd; 00029 float zd; 00030 00033 00046 00047 Velocity3D(); 00048 00051 00064 00065 00066 00067 explicit Velocity3D(float pInit); 00068 00071 00084 00085 00086 00087 00088 Velocity3D( 00089 float pXd, 00090 float pYd, 00091 float pZd); 00092 00095 00108 00109 00110 00111 00112 00113 Velocity3D(const std::vector<float>& pFloats); 00114 00119 Velocity3D operator+ (const Velocity3D& pVel2) const; 00120 00125 Velocity3D operator- (const Velocity3D& pVel2) const; 00126 00130 Velocity3D operator+ () const; 00131 00135 Velocity3D operator- () const; 00136 00141 Velocity3D& operator+= (const Velocity3D& pVel2); 00142 00147 Velocity3D& operator-= (const Velocity3D& pVel2); 00148 00153 bool operator== (const Velocity3D& pVel2) const; 00154 00159 bool operator!= (const Velocity3D& pVel2) const; 00160 00165 Velocity3D operator* (const float pVal) const; 00166 00171 Velocity3D operator/ (const float pVal) const; 00172 00177 Velocity3D& operator*= (const float pVal); 00178 00183 Velocity3D& operator/= (const float pVal); 00184 00195 bool isNear( 00196 const Velocity3D& pVel2, 00197 const float& pEpsilon=0.0001f) const; 00198 00199 00208 float norm () const; 00209 00218 Velocity3D normalize() const; 00219 00223 std::vector<float> toVector() const; 00224 }; 00225 00226 Velocity3D operator* ( 00227 const float pM, 00228 const Velocity3D& pVel1); 00229 00240 float norm (const Velocity3D& pVel); 00241 00252 Velocity3D normalize(const Velocity3D& pVel); 00253 00254 } // end namespace Math 00255 } // end namespace AL 00256 #endif // _LIBALMATH_ALMATH_TYPES_ALVELOCITY3D_H_