Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*******************************************************************************
* Transformation2D.h
*
* (C) 2008 AG Aktives Sehen <agas@uni-koblenz.de>
* Universitaet Koblenz-Landau
*
* $Id: Transformation2D.h 44313 2011-04-06 22:46:28Z agas $
*******************************************************************************/
#ifndef TRANSFORMATION2D_H
#define TRANSFORMATION2D_H
#include <cmath>
#include <vector>
//#include "Workers/Math/Vec.h"
#include "Point2D.h"
#include "Line2D.h"
/**
* @class Transformation2D
*
* @author Susanne Maur
*
* @brief Class to describe a transformation of poses in 2D.
* This inplies a translation in x and y direction each and a rotation.
*/
class Transformation2D : public CVec2
{
public:
/**
* Constructor that initializes the members.
* @param x translation in x direction in m
* @param y translation in y direction in m
* @param theta rotation in radiants
*/
Transformation2D ( double x, double y, double theta );
/**
* Constructor that initializes the members.
* @param vec a vector which represents the translation in x and y direction
* @param theta rotation in radiants
*/
Transformation2D ( const CVec2& vec, double theta );
/**
* Default constructor sets all members to 0.0.
*/
Transformation2D();
/**
* Default destructor.
*/
~Transformation2D();
/**
* Sets the values of transformation.
* @param x translation in x direction in mm
* @param y translation in y direction in mm
* @param theta rotation in radiants
*/
void set ( double x, double y, double theta );
/**
* Returns the rotation in radiants.
* @return rotation in radiants
*/
double theta() const;
/**
* Adds two transformations.
*/
Transformation2D operator+ ( Transformation2D t ) const;
Transformation2D& operator+= ( Transformation2D t );
/**
* Subtracts two transformations.
*/
Transformation2D operator- ( Transformation2D t ) const;
Transformation2D& operator-= ( Transformation2D t );
/**
* Scales a transformation by a factor
*/
Transformation2D operator* ( float factor ) const;
Transformation2D& operator*= ( float factor );
/**
* Scales a transformation by a factor
*/
Transformation2D operator/ ( float factor ) const;
Transformation2D& operator/= ( float factor );
/**
* Test equality of transformations.
*/
bool operator== ( Transformation2D t ) const;
bool operator!= ( Transformation2D t ) const;
/**
* Compare transformations.
* (attention: algebraic signs are taken into account, if necessary use fabs())
*/
bool operator<= ( Transformation2D t ) const;
bool operator>= ( Transformation2D t ) const;
bool operator< ( Transformation2D t ) const;
bool operator> ( Transformation2D t ) const;
/**
* Applies abs() on every attribute.
*/
Transformation2D abs() const;
/**
* Inverts the transformation, scales every attribute with -1.
*/
Transformation2D inverse() const;
/**
* Transformes points by first rotation, then translating.
*/
Point2D transform ( const Point2D& point ) const;
std::vector<Point2D> transform ( const std::vector<Point2D>& points ) const;
/**
* Transformes lines by first rotation, then translating.
*/
Line2D transform ( const Line2D& line ) const;
std::vector<Line2D> transform ( const std::vector<Line2D>& lines ) const;
/**
* Returns the string representation of the transformation.
* @return string representation of the transformation.
*/
std::string toString() const;
private:
double m_Theta;
};
#endif