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