- wxTransformMatrix(void);
- wxTransformMatrix(const wxTransformMatrix& mat);
-
- double GetValue(int row, int col) const;
- void SetValue(int row, int col, double value);
-
- void operator = (const wxTransformMatrix& mat);
- bool operator == (const wxTransformMatrix& mat);
- bool operator != (const wxTransformMatrix& mat);
-
- double& operator()(int row, int col);
- double operator()(int row, int col) const;
-
- // Invert matrix
- bool Invert(void);
-
- // Make into identity matrix
- bool Identity(void);
-
- // Is the matrix the identity matrix?
- // Only returns a flag, which is set whenever an operation
- // is done.
- inline bool IsIdentity(void) const { return m_isIdentity; };
-
- // This does an actual check.
- inline bool IsIdentity1(void) const ;
-
- // Isotropic scaling
- bool Scale(double scale);
-
- // Translate
- bool Translate(double x, double y);
+ wxTransformMatrix(void);
+ wxTransformMatrix(const wxTransformMatrix& mat);
+
+ //get the value in the matrix at col,row
+ //rows are horizontal (second index of m_matrix member)
+ //columns are vertical (first index of m_matrix member)
+ double GetValue(int col, int row) const;
+
+ //set the value in the matrix at col,row
+ //rows are horizontal (second index of m_matrix member)
+ //columns are vertical (first index of m_matrix member)
+ void SetValue(int col, int row, double value);
+
+ void operator = (const wxTransformMatrix& mat);
+ bool operator == (const wxTransformMatrix& mat) const;
+ bool operator != (const wxTransformMatrix& mat) const;
+
+ //multiply every element by t
+ wxTransformMatrix& operator*=(const double& t);
+ //divide every element by t
+ wxTransformMatrix& operator/=(const double& t);
+ //add matrix m to this t
+ wxTransformMatrix& operator+=(const wxTransformMatrix& m);
+ //subtract matrix m from this
+ wxTransformMatrix& operator-=(const wxTransformMatrix& m);
+ //multiply matrix m with this
+ wxTransformMatrix& operator*=(const wxTransformMatrix& m);
+
+ // constant operators
+
+ //multiply every element by t and return result
+ wxTransformMatrix operator*(const double& t) const;
+ //divide this matrix by t and return result
+ wxTransformMatrix operator/(const double& t) const;
+ //add matrix m to this and return result
+ wxTransformMatrix operator+(const wxTransformMatrix& m) const;
+ //subtract matrix m from this and return result
+ wxTransformMatrix operator-(const wxTransformMatrix& m) const;
+ //multiply this by matrix m and return result
+ wxTransformMatrix operator*(const wxTransformMatrix& m) const;
+ wxTransformMatrix operator-() const;
+
+ //rows are horizontal (second index of m_matrix member)
+ //columns are vertical (first index of m_matrix member)
+ double& operator()(int col, int row);
+
+ //rows are horizontal (second index of m_matrix member)
+ //columns are vertical (first index of m_matrix member)
+ double operator()(int col, int row) const;
+
+ // Invert matrix
+ bool Invert(void);
+
+ // Make into identity matrix
+ bool Identity(void);
+
+ // Is the matrix the identity matrix?
+ // Only returns a flag, which is set whenever an operation
+ // is done.
+ inline bool IsIdentity(void) const { return m_isIdentity; };
+
+ // This does an actual check.
+ inline bool IsIdentity1(void) const ;
+
+ //Scale by scale (isotropic scaling i.e. the same in x and y):
+ //!ex:
+ //!code: | scale 0 0 |
+ //!code: matrix' = | 0 scale 0 | x matrix
+ //!code: | 0 0 scale |
+ bool Scale(double scale);
+
+ //Scale with center point and x/y scale
+ //
+ //!ex:
+ //!code: | xs 0 xc(1-xs) |
+ //!code: matrix' = | 0 ys yc(1-ys) | x matrix
+ //!code: | 0 0 1 |
+ wxTransformMatrix& Scale(const double &xs, const double &ys,const double &xc, const double &yc);
+
+ // mirror a matrix in x, y
+ //!ex:
+ //!code: | -1 0 0 |
+ //!code: matrix' = | 0 -1 0 | x matrix
+ //!code: | 0 0 1 |
+ wxTransformMatrix& Mirror(bool x=true, bool y=false);
+ // Translate by dx, dy:
+ //!ex:
+ //!code: | 1 0 dx |
+ //!code: matrix' = | 0 1 dy | x matrix
+ //!code: | 0 0 1 |
+ bool Translate(double x, double y);
+
+ // Rotate clockwise by the given number of degrees:
+ //!ex:
+ //!code: | cos sin 0 |
+ //!code: matrix' = | -sin cos 0 | x matrix
+ //!code: | 0 0 1 |
+ bool Rotate(double angle);
+
+ //Rotate counter clockwise with point of rotation
+ //
+ //!ex:
+ //!code: | cos(r) -sin(r) x(1-cos(r))+y(sin(r)|
+ //!code: matrix' = | sin(r) cos(r) y(1-cos(r))-x(sin(r)| x matrix
+ //!code: | 0 0 1 |
+ wxTransformMatrix& Rotate(const double &r, const double &x, const double &y);
+
+ // Transform X value from logical to device
+ inline double TransformX(double x) const;
+
+ // Transform Y value from logical to device
+ inline double TransformY(double y) const;
+
+ // Transform a point from logical to device coordinates
+ bool TransformPoint(double x, double y, double& tx, double& ty) const;
+
+ // Transform a point from device to logical coordinates.
+ // Example of use:
+ // wxTransformMatrix mat = dc.GetTransformation();
+ // mat.Invert();
+ // mat.InverseTransformPoint(x, y, x1, y1);
+ // OR (shorthand:)
+ // dc.LogicalToDevice(x, y, x1, y1);
+ // The latter is slightly less efficient if we're doing several
+ // conversions, since the matrix is inverted several times.
+ // N.B. 'this' matrix is the inverse at this point
+ bool InverseTransformPoint(double x, double y, double& tx, double& ty) const;
+
+ double Get_scaleX();
+ double Get_scaleY();
+ double GetRotation();
+ void SetRotation(double rotation);