libalmath  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
alposition6d.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_ALPOSITION6D_H_
10 #define _LIBALMATH_ALMATH_TYPES_ALPOSITION6D_H_
11 
12 #include <vector>
13 #include <almath/api.h>
14 
15 namespace AL {
16  namespace Math {
17 
24  struct ALMATH_API Position6D {
26  float x;
28  float y;
30  float z;
32  float wx;
34  float wy;
36  float wz;
37 
40 
59  Position6D();
61 
64 
83  explicit Position6D(float pInit);
87 
90 
109  Position6D(
117  float pX,
118  float pY,
119  float pZ,
120  float pWx,
121  float pWy,
122  float pWz);
123 
126 
145  Position6D(const std::vector<float>& pFloats);
151 
156  inline Position6D operator+ (const Position6D& pPos2) const
157  {
158  return Position6D(
159  x + pPos2.x,
160  y + pPos2.y,
161  z + pPos2.z,
162  wx + pPos2.wx,
163  wy + pPos2.wy,
164  wz + pPos2.wz);
165  }
166 
171  inline Position6D operator- (const Position6D& pPos2) const
172  {
173  return Position6D(
174  x - pPos2.x,
175  y - pPos2.y,
176  z - pPos2.z,
177  wx - pPos2.wx,
178  wy - pPos2.wy,
179  wz - pPos2.wz);
180  }
181 
185  inline Position6D operator+ (void) const
186  {
187  return *this;
188  }
189 
193  inline Position6D operator- () const
194  {
195  return Position6D(-x, -y, -z, -wx, -wy, -wz);
196  }
197 
202  Position6D& operator+= (const Position6D& pPos2);
203 
208  Position6D& operator-= (const Position6D& pPos2);
209 
214  bool operator== (const Position6D& pPos2) const;
215 
220  bool operator!= (const Position6D& pPos2) const;
221 
226  inline Position6D operator* (float pVal) const
227  {
228  return Position6D(
229  x * pVal,
230  y * pVal,
231  z * pVal,
232  wx * pVal,
233  wy * pVal,
234  wz * pVal);
235  }
236 
241  Position6D operator/ (float pVal) const;
242 
247  Position6D& operator*= (float pVal);
248 
253  Position6D& operator/= (float pVal);
254 
266  bool isNear(
267  const Position6D& pPos2,
268  const float& pEpsilon=0.0001f) const;
269 
280  float distanceSquared(const Position6D& pPos2) const;
281 
292  float distance(const Position6D& pPos2) const;
293 
302  float norm() const;
303 
307  void toVector (std::vector<float>& pReturnVector) const;
308  std::vector<float> toVector (void) const;
309 
314  void writeToVector(std::vector<float>::iterator& pIt) const;
315 
316  }; // end struct
317 
318 
331  ALMATH_API float distanceSquared(
332  const Position6D& pPos1,
333  const Position6D& pPos2);
334 
335 
347  ALMATH_API float distance(
348  const Position6D& pPos1,
349  const Position6D& pPos2);
350 
361  ALMATH_API float norm(const Position6D& pPos);
362 
373  ALMATH_API Position6D normalize(const Position6D& pPos);
374 
375  } // end namespace math
376 } // end namespace al
377 
378 #endif // _LIBALMATH_ALMATH_TYPES_ALPOSITION6D_H_
ALMATH_API float distance(const Pose2D &pPos1, const Pose2D &pPos2)
Compute the distance between two Pose2D.
BodyMass< T > operator+(const BodyMass< T > &lhs, const BodyMass< T > &rhs)
Definition: bodymass.h:111
bool isNear(const Transform &lhs, const Transform &rhs, double epsilon)
Definition: qigeometry.h:111
ALMATH_API float distanceSquared(const Pose2D &pPos1, const Pose2D &pPos2)
Compute the squared distance between two Pose2D.
bool operator!=(const Pose &lhs, const Pose &rhs)
Definition: urdf.h:340
Create and play with a Position6D.
Definition: alposition6d.h:24
ALMATH_API Position2D normalize(const Position2D &pPos)
Normalize a Position2D.
ALMATH_API float norm(const Position2D &pPos)
Compute the norm of a Position2D.
bool operator==(const BodyMass< T > &lhs, const BodyMass< T > &rhs)
Definition: bodymass.h:79
ALMATH_API Position3D operator*(const Rotation &pRot, const Position3D &pPos)
Overloading of operator * between Rotation and Position3D: