libalmath  1.12
almath/types/alposition6d.h
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_ALPOSITION6D_H_
00013 #define _LIBALMATH_ALMATH_TYPES_ALPOSITION6D_H_
00014 
00015 #include <vector>
00016 
00017 namespace AL {
00018   namespace Math {
00019 
00026     struct Position6D {
00028       float x;
00030       float y;
00032       float z;
00034       float wx;
00036       float wy;
00038       float wz;
00039 
00042 
00061 
00062       Position6D();
00063 
00066 
00085 
00086 
00087 
00088       explicit Position6D(float pInit);
00089 
00092 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118       Position6D(
00119         float pX,
00120         float pY,
00121         float pZ,
00122         float pWx,
00123         float pWy,
00124         float pWz);
00125 
00128 
00147 
00148 
00149 
00150 
00151 
00152       Position6D(const std::vector<float>& pFloats);
00153 
00158       Position6D operator+ (const Position6D& pPos2) const;
00159 
00164       Position6D operator- (const Position6D& pPos2) const;
00165 
00169       Position6D operator+ () const;
00170 
00174       Position6D operator- () const;
00175 
00180       Position6D& operator+= (const Position6D& pPos2);
00181 
00186       Position6D& operator-= (const Position6D& pPos2);
00187 
00192       bool operator== (const Position6D& pPos2) const;
00193 
00198       bool operator!= (const Position6D& pPos2) const;
00199 
00204       Position6D operator* (float pVal) const;
00205 
00210       Position6D operator/ (float pVal) const;
00211 
00216       Position6D& operator*= (float pVal);
00217 
00222       Position6D& operator/= (float pVal);
00223 
00235       bool isNear(
00236         const Position6D& pPos2,
00237         const float&      pEpsilon=0.0001f) const;
00238 
00249       float distanceSquared(const Position6D& pPos2) const;
00250 
00261       float distance(const Position6D& pPos2) const;
00262 
00271       float norm() const;
00272 
00276       std::vector<float> toVector () const;
00277     }; // end struct
00278 
00279 
00292     float distanceSquared(
00293       const Position6D& pPos1,
00294       const Position6D& pPos2);
00295 
00296 
00308     float distance(
00309       const Position6D& pPos1,
00310       const Position6D& pPos2);
00311 
00322     float norm(const Position6D& pPos);
00323 
00334     Position6D normalize(const Position6D& pPos);
00335 
00336   } // end namespace math
00337 } // end namespace al
00338 
00339 #endif  // _LIBALMATH_ALMATH_TYPES_ALPOSITION6D_H_
 All Classes Namespaces Functions Variables