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_ALPOSE2D_H_ 00013 #define _LIBALMATH_ALMATH_TYPES_ALPOSE2D_H_ 00014 00015 #include <vector> 00016 00017 namespace AL { 00018 namespace Math { 00019 00027 struct Pose2D { 00029 float x; 00031 float y; 00033 float theta; 00034 00037 00050 00051 Pose2D(); 00052 00055 00068 00069 00070 explicit Pose2D(float pInit); 00071 00074 00087 00088 00089 00090 00091 explicit Pose2D( 00092 float pX, 00093 float pY, 00094 float pTheta); 00095 00098 00111 00112 00113 00114 00115 00116 00117 Pose2D(const std::vector<float>& pFloats); 00118 00123 Pose2D operator+ (const Pose2D& pPos2) const; 00124 00129 Pose2D operator- (const Pose2D& pPos2) const; 00130 00134 Pose2D operator+ () const; 00135 00139 Pose2D operator- () const; 00140 00145 Pose2D& operator+= (const Pose2D& pPos2); 00146 00151 Pose2D& operator-= (const Pose2D& pPos2); 00152 00157 Pose2D& operator*= (const Pose2D& pPos2); 00158 00163 Pose2D operator* (const Pose2D& pPos2) const; 00164 00169 bool operator==(const Pose2D& pPos2) const; 00170 00175 bool operator!=(const Pose2D& pPos2) const; 00176 00189 float distanceSquared(const Pose2D& pPos2) const; 00190 00201 float distance(const Pose2D& pPos2) const; 00202 00206 Pose2D inverse() const; 00207 00218 bool isNear(const Pose2D& pPos2, 00219 const float& pEpsilon=0.0001f) const; 00220 00224 std::vector<float> toVector() const; 00225 00226 }; // end struct 00227 00228 00240 float distanceSquared( 00241 const Pose2D& pPos1, 00242 const Pose2D& pPos2); 00243 00255 float distance( 00256 const Pose2D& pPos1, 00257 const Pose2D& pPos2); 00258 00265 Pose2D pose2DInverse(const Pose2D& pPos); 00266 00273 void pose2DInverse( 00274 const Pose2D& pPos, 00275 Pose2D& pRes); 00276 00277 } // end namespace math 00278 } // end namespace AL 00279 #endif // _LIBALMATH_ALMATH_TYPES_ALPOSE2D_H_