libalmath  1.14
 All Classes Namespaces Functions Variables Typedefs Groups Pages
alpose2d.h
1 /*
2  * Copyright (c) 2012 Aldebaran Robotics. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the COPYING file.
5  */
6 
7 
8 #pragma once
9 #ifndef _LIBALMATH_ALMATH_TYPES_ALPOSE2D_H_
10 #define _LIBALMATH_ALMATH_TYPES_ALPOSE2D_H_
11 
12 #include <vector>
13 
14 namespace AL {
15  namespace Math {
16 
24  struct Pose2D {
26  float x;
28  float y;
30  float theta;
31 
34 
47 
48  Pose2D();
49 
52 
65 
66 
67  explicit Pose2D(float pInit);
68 
71 
84 
85 
86 
87 
88  explicit Pose2D(
89  float pX,
90  float pY,
91  float pTheta);
92 
95 
108 
109 
110 
111 
112 
113 
114  Pose2D(const std::vector<float>& pFloats);
115 
120  Pose2D operator+ (const Pose2D& pPos2) const;
121 
126  Pose2D operator- (const Pose2D& pPos2) const;
127 
131  Pose2D operator+ () const;
132 
136  Pose2D operator- () const;
137 
142  Pose2D& operator+= (const Pose2D& pPos2);
143 
148  Pose2D& operator-= (const Pose2D& pPos2);
149 
154  Pose2D& operator*= (const Pose2D& pPos2);
155 
160  Pose2D operator* (const Pose2D& pPos2) const;
161 
166  bool operator==(const Pose2D& pPos2) const;
167 
172  bool operator!=(const Pose2D& pPos2) const;
173 
178  Pose2D operator* (float pVal) const;
179 
184  Pose2D operator/ (float pVal) const;
185 
190  Pose2D& operator*= (float pVal);
191 
196  Pose2D& operator/= (float pVal);
197 
210  float distanceSquared(const Pose2D& pPos2) const;
211 
222  float distance(const Pose2D& pPos2) const;
223 
227  Pose2D inverse() const;
228 
239  bool isNear(const Pose2D& pPos2,
240  const float& pEpsilon=0.0001f) const;
241 
245  std::vector<float> toVector() const;
246 
247  }; // end struct
248 
249 
261  float distanceSquared(
262  const Pose2D& pPos1,
263  const Pose2D& pPos2);
264 
276  float distance(
277  const Pose2D& pPos1,
278  const Pose2D& pPos2);
279 
286  Pose2D pose2DInverse(const Pose2D& pPos);
287 
294  void pose2DInverse(
295  const Pose2D& pPos,
296  Pose2D& pRes);
297 
298  } // end namespace math
299 } // end namespace AL
300 #endif // _LIBALMATH_ALMATH_TYPES_ALPOSE2D_H_