- Aldebaran documentation |
- C++ Libraries |
- index

libalmath 2.8.7.4

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
alposition2d.h
Go to the documentation of this file.
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_ALPOSITION2D_H_
10 #define _LIBALMATH_ALMATH_TYPES_ALPOSITION2D_H_
11
12 #include <vector>
13 #include <almath/api.h>
14
15 namespace AL {
16 namespace Math {
17
24 struct ALMATH_API Position2D
25 {
27 float x;
29 float y;
30
33
44 Position2D();
46
49
60 explicit Position2D(float pInit);
64
67
78 Position2D(float pX, float pY);
82
85
96 Position2D(const std::vector<float>& pFloats);
102
109 static Position2D fromPolarCoordinates(const float pRadius,
110 const float pAngle);
111
116 inline Position2D operator+ (const Position2D& pPos2) const
117 {
118 return Position2D(x + pPos2.x, y + pPos2.y);
119 }
120
125 inline Position2D operator- (const Position2D& pPos2) const
126 {
127 return Position2D(x - pPos2.x, y - pPos2.y);
128 }
129
133 inline Position2D operator+ (void) const
134 {
135 return *this;
136 }
137
141 inline Position2D operator- () const
142 {
143 return Position2D(-x, -y);
144 }
145
150 Position2D& operator+= (const Position2D& pPos2);
151
156 Position2D& operator-= (const Position2D& pPos2);
157
165 bool operator==(const Position2D& pPos2) const;
166
174 bool operator!=(const Position2D& pPos2) const;
175
180 inline Position2D operator* (float pVal) const
181 {
182 return Position2D(x*pVal, y*pVal);
183 }
184
189 Position2D operator/ (float pVal) const;
190
195 Position2D& operator*= (float pVal);
196
201 Position2D& operator/= (float pVal);
202
213 float distanceSquared(const Position2D& pPos2) const;
214
225 float distance(const Position2D& pPos2) const;
226
236 bool isNear(
237 const Position2D& pPos2,
238 const float& pEpsilon=0.0001f) const;
239
248 float norm() const;
249
258 Position2D normalize() const;
259
270 float dotProduct(const Position2D& pPos2) const;
271
282 float crossProduct(const Position2D& pPos2) const;
283
287 void toVector(std::vector<float>& pReturnVector) const;
288 std::vector<float> toVector(void) const;
289
294 void writeToVector(std::vector<float>::iterator& pIt) const;
295
301 float getAngle() const;
302 };
303
304 // TODO : Need this ?
305 ALMATH_API Position2D operator* (
306 const float pM,
307 const Position2D& pPos1);
308
320 ALMATH_API float distanceSquared(
321 const Position2D& pPos1,
322 const Position2D& pPos2);
323
335 ALMATH_API float distance(
336 const Position2D& pPos1,
337 const Position2D& pPos2);
338
349 ALMATH_API float norm(const Position2D& pPos);
350
361 ALMATH_API Position2D normalize(const Position2D& pPos);
362
373 ALMATH_API float dotProduct(
374 const Position2D& pPos1,
375 const Position2D& pPos2);
376
388 ALMATH_API float crossProduct(
389 const Position2D& pPos1,
390 const Position2D& pPos2);
391
402 ALMATH_API void crossProduct(
403 const Position2D& pPos1,
404 const Position2D& pPos2,
405 float& pRes);
406
407 } // end namespace math
408 } // end namespace al
409 #endif // _LIBALMATH_ALMATH_TYPES_ALPOSITION2D_H_
AL::Math::distance
ALMATH_API float distance(const Pose2D &pPos1, const Pose2D &pPos2)
Compute the distance between two Pose2D.
AL::Math::operator+
BodyMass< T > operator+(const BodyMass< T > &lhs, const BodyMass< T > &rhs)
Definition: bodymass.h:111
AL::Math::Position2D
Create and play with a Position2D.
Definition: alposition2d.h:24
qi::geometry::isNear
bool isNear(const Transform &lhs, const Transform &rhs, double epsilon)
Definition: qigeometry.h:111
AL::Math::distanceSquared
ALMATH_API float distanceSquared(const Pose2D &pPos1, const Pose2D &pPos2)
Compute the squared distance between two Pose2D.
AL::Math::Position2D::x
float x
Definition: alposition2d.h:27
AL::urdf::operator!=
bool operator!=(const Pose &lhs, const Pose &rhs)
Definition: urdf.h:340
AL::Math::crossProduct
ALMATH_API float crossProduct(const Position2D &pPos1, const Position2D &pPos2)
Compute the cross Product of two Position2D.
AL::Math::dotProduct
ALMATH_API float dotProduct(const Position2D &pPos1, const Position2D &pPos2)
Compute the dot Product between two Position2D:
AL::Math::normalize
ALMATH_API Position2D normalize(const Position2D &pPos)
Normalize a Position2D.
AL::Math::norm
ALMATH_API float norm(const Position2D &pPos)
Compute the norm of a Position2D.
AL::Math::operator==
bool operator==(const BodyMass< T > &lhs, const BodyMass< T > &rhs)
Definition: bodymass.h:79
AL::Math::operator*
ALMATH_API Position3D operator*(const Rotation &pRot, const Position3D &pPos)
Overloading of operator * between Rotation and Position3D:
AL::Math::Position2D::y
float y
Definition: alposition2d.h:29