libalmath  1.14.5
almath/types/alpose2d.h
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_ALPOSE2D_H_
00010 #define _LIBALMATH_ALMATH_TYPES_ALPOSE2D_H_
00011 
00012 #include <vector>
00013 
00014 namespace AL {
00015   namespace Math {
00016 
00024     struct Pose2D {
00026       float x;
00028       float y;
00030       float theta;
00031 
00034 
00047 
00048       Pose2D();
00049 
00052 
00065 
00066 
00067       explicit Pose2D(float pInit);
00068 
00071 
00084 
00085 
00086 
00087 
00088       explicit Pose2D(
00089         float pX,
00090         float pY,
00091         float pTheta);
00092 
00095 
00108 
00109 
00110 
00111 
00112 
00113 
00114       Pose2D(const std::vector<float>& pFloats);
00115 
00120       Pose2D operator+ (const Pose2D& pPos2) const;
00121 
00126       Pose2D operator- (const Pose2D& pPos2) const;
00127 
00131       Pose2D operator+ () const;
00132 
00136       Pose2D operator- () const;
00137 
00142       Pose2D& operator+= (const Pose2D& pPos2);
00143 
00148       Pose2D& operator-= (const Pose2D& pPos2);
00149 
00154       Pose2D& operator*= (const Pose2D& pPos2);
00155 
00160       Pose2D operator* (const Pose2D& pPos2) const;
00161 
00166       bool operator==(const Pose2D& pPos2) const;
00167 
00172       bool operator!=(const Pose2D& pPos2) const;
00173 
00178       Pose2D operator* (float pVal) const;
00179 
00184       Pose2D operator/ (float pVal) const;
00185 
00190       Pose2D& operator*= (float pVal);
00191 
00196       Pose2D& operator/= (float pVal);
00197 
00210       float distanceSquared(const Pose2D& pPos2) const;
00211 
00222       float distance(const Pose2D& pPos2) const;
00223 
00227       Pose2D inverse() const;
00228 
00239       bool isNear(const Pose2D& pPos2,
00240                   const float&  pEpsilon=0.0001f) const;
00241 
00245       std::vector<float> toVector() const;
00246 
00247     }; // end struct
00248 
00249 
00261     float distanceSquared(
00262       const Pose2D& pPos1,
00263       const Pose2D& pPos2);
00264 
00276     float distance(
00277       const Pose2D& pPos1,
00278       const Pose2D& pPos2);
00279 
00286     Pose2D pose2DInverse(const Pose2D& pPos);
00287 
00294     void pose2DInverse(
00295       const Pose2D& pPos,
00296       Pose2D&       pRes);
00297 
00298   } // end namespace math
00299 } // end namespace AL
00300 #endif  // _LIBALMATH_ALMATH_TYPES_ALPOSE2D_H_
 All Classes Namespaces Functions Variables