Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef __VECTORTRANSFORMATION2D_H__
00011 #define __VECTORTRANSFORMATION2D_H__
00012
00013 namespace libmspub
00014 {
00015 struct Vector2D
00016 {
00017 double m_x;
00018 double m_y;
00019 Vector2D(double x, double y) : m_x(x), m_y(y)
00020 {
00021 }
00022 };
00023 Vector2D operator+(const Vector2D &l, const Vector2D &r);
00024 Vector2D operator-(const Vector2D &l, const Vector2D &r);
00025 class VectorTransformation2D
00026 {
00027 double m_m11, m_m12, m_m21, m_m22;
00028 double m_x, m_y;
00029 public:
00030 VectorTransformation2D();
00031 Vector2D transform(Vector2D original) const;
00032 Vector2D transformWithOrigin(Vector2D v, Vector2D origin) const;
00033 double getRotation() const;
00034 double getHorizontalScaling() const;
00035 double getVerticalScaling() const;
00036 bool orientationReversing() const;
00037 friend VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r);
00038 static VectorTransformation2D fromFlips(bool flipH, bool flipV);
00039 static VectorTransformation2D fromTranslate(double x, double y);
00040 static VectorTransformation2D fromCounterRadians(double theta);
00041 };
00042 VectorTransformation2D operator*(const VectorTransformation2D &l, const VectorTransformation2D &r);
00043 }
00044
00045 #endif
00046