Ravelin
Transform2.h
1 /****************************************************************************
2  * Copyright 2013 Evan Drumwright
3  * This library is distributed under the terms of the Apache V2.0
4  * License (obtainable from http://www.apache.org/licenses/LICENSE-2.0).
5  ****************************************************************************/
6 
7 #ifndef TRANSFORM2
8 #error This class is not to be included by the user directly. Use Transform2d.h or Transform2h.h instead.
9 #endif
10 
11 class POSE2;
12 
15 {
16  public:
17  TRANSFORM2();
18  TRANSFORM2(const TRANSFORM2& source) { operator=(source); }
19  TRANSFORM2(const ROT2& r, const ORIGIN2& x);
20  TRANSFORM2(const ORIGIN2& x);
21  TRANSFORM2(const ROT2& r);
22  static TRANSFORM2 identity() { TRANSFORM2 T; T.set_identity(); return T; }
23  static bool rel_equal(const TRANSFORM2& p1, const TRANSFORM2& p2, REAL tol=EPS);
24  static REAL wrap(REAL theta);
25  POSE2 transform(const POSE2& p) const;
26  POSE2 inverse_transform(const POSE2& p) const;
27  VECTOR2 transform_point(const VECTOR2& v) const;
28  VECTOR2 transform_vector(const VECTOR2& v) const;
29  VECTOR2 inverse_transform_point(const VECTOR2& v) const;
32  TRANSFORM2& invert();
33  TRANSFORM2 inverse() const { return invert(*this); }
34  static TRANSFORM2 invert(const TRANSFORM2& m);
35  TRANSFORM2& set(const ROT2& r, const ORIGIN2& v);
36  TRANSFORM2& set(const ROT2& r);
37  TRANSFORM2& operator=(const TRANSFORM2& source);
38  TRANSFORM2 operator*(const TRANSFORM2& m) const;
39  static ORIGIN2 interpolate_transform_vector(const TRANSFORM2& T1, const TRANSFORM2& T2, REAL t, const ORIGIN2& o);
40  static ORIGIN2 interpolate_transform_point(const TRANSFORM2& T1, const TRANSFORM2& T2, REAL t, const ORIGIN2& o);
41  static ORIGIN2 interpolate_inverse_transform_vector(const TRANSFORM2& T1, const TRANSFORM2& T2, REAL t, const ORIGIN2& o);
42  static ORIGIN2 interpolate_inverse_transform_point(const TRANSFORM2& T1, const TRANSFORM2& T2, REAL t, const ORIGIN2& o);
43 
46 
49 
51  boost::shared_ptr<const POSE2> source;
52 
54  boost::shared_ptr<const POSE2> target;
55 
56 }; // end class
57 
58 std::ostream& operator<<(std::ostream& out, const TRANSFORM2& m);
59 
TRANSFORM2 & invert()
Special method for inverting a 2D pose.
Definition: Transform2.cpp:289
VECTOR2 inverse_transform_vector(const VECTOR2 &v) const
Transforms a vector from one pose to another.
Definition: Transform2.cpp:243
VECTOR2 transform_vector(const VECTOR2 &v) const
Transforms a vector from one pose to another.
Definition: Transform2.cpp:230
A 2D rigid body pose.
Definition: Pose2.h:12
A two-dimensional floating point vector used for computational geometry calculations and with associa...
Definition: Vector2.h:15
static ORIGIN2 interpolate_inverse_transform_vector(const TRANSFORM2 &T1, const TRANSFORM2 &T2, REAL t, const ORIGIN2 &o)
Tranforms a vector with the inverse of an interpolated transform (between transforms T1 and T2) ...
Definition: Transform2.cpp:96
boost::shared_ptr< const POSE2 > source
the source pose
Definition: Transform2.h:51
TRANSFORM2 & set_identity()
Sets this matrix to identity.
Definition: Transform2.cpp:222
TRANSFORM2 operator*(const TRANSFORM2 &m) const
Concatenates transformations.
Definition: Transform2.cpp:302
ROT2 r
the orientation of the pose frame
Definition: Transform2.h:45
static bool rel_equal(const TRANSFORM2 &p1, const TRANSFORM2 &p2, REAL tol=EPS)
Determines whether two poses in 2D are relatively equivalent.
Definition: Transform2.cpp:189
VECTOR2 inverse_transform_point(const VECTOR2 &v) const
Transforms a point from one pose to another.
Definition: Transform2.cpp:270
static ORIGIN2 interpolate_transform_vector(const TRANSFORM2 &T1, const TRANSFORM2 &T2, REAL t, const ORIGIN2 &o)
Tranforms a vector with an interpolated transform (between transforms T1 and T2)
Definition: Transform2.cpp:51
VECTOR2 transform_point(const VECTOR2 &v) const
Transforms a point from one pose to another.
Definition: Transform2.cpp:257
POSE2 transform(const POSE2 &p) const
Transforms a pose.
Definition: Transform2.cpp:134
POSE2 inverse_transform(const POSE2 &p) const
Transforms a pose.
Definition: Transform2.cpp:150
TRANSFORM2 & set(const ROT2 &r, const ORIGIN2 &v)
Sets the pose from a rotation and translation vector.
Definition: Transform2.cpp:206
Represents an orientation in 2D.
Definition: Rot2.h:12
static ORIGIN2 interpolate_transform_point(const TRANSFORM2 &T1, const TRANSFORM2 &T2, REAL t, const ORIGIN2 &o)
Tranforms a point with an interpolated pose (between poses T1 and T2)
Definition: Transform2.cpp:72
static ORIGIN2 interpolate_inverse_transform_point(const TRANSFORM2 &T1, const TRANSFORM2 &T2, REAL t, const ORIGIN2 &o)
Tranforms a point with the inverse of an interpolated pose (between poses T1 and T2) ...
Definition: Transform2.cpp:117
A two-dimensional floating point vector used for computational geometry calculations and without asso...
Definition: Origin2.h:14
ORIGIN2 x
the position of the pose frame
Definition: Transform2.h:48
A transformation between 2D rigid body poses.
Definition: Transform2.h:14
TRANSFORM2()
Default constructor.
Definition: Transform2.cpp:11
boost::shared_ptr< const POSE2 > target
the target pose
Definition: Transform2.h:54