]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/affinematrix2d.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: affinematrix2d.h
3 // Purpose: interface of wxAffineMatrix2D
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 @class wxAffineMatrix2D
11 A 3x2 matrix representing an affine 2D transformation.
18 class wxAffineMatrix2D
24 The matrix elements are initialize to the identity matrix.
29 Get the component values of the matrix.
32 The rotational components of the matrix (upper 2 x 2), must be
35 The translational components of the matrix, may be @NULL.
37 void Get(wxMatrix2D
* mat2D
, wxPoint2DDouble
* tr
) const;
40 Set all elements of this matrix.
43 The rotational components of the matrix (upper 2 x 2).
45 The translational components of the matrix.
47 void Set(const wxMatrix2D
& mat2D
, const wxPoint2DDouble
& tr
);
50 Concatenate this matrix with another one.
52 The parameter matrix is the multiplicand.
58 // | t.m_11 t.m_12 0 | | m_11 m_12 0 |
59 // matrix' = | t.m_21 t.m_22 0 | x | m_21 m_22 0 |
60 // | t.m_tx t.m_ty 1 | | m_tx m_ty 1 |
63 void Concat(const wxAffineMatrix2DBase
& t
);
68 If the matrix is not invertible, i.e. if its determinant is 0, returns
69 false and doesn't modify it.
73 // Invert | m_21 m_22 0 |
80 Check if this is the identity matrix.
82 bool IsIdentity() const;
86 Check that this matrix is identical with @t.
89 The matrix compared with this.
91 void IsEqual(const wxAffineMatrix2DBase
& t
);
92 bool operator==(const wxAffineMatrix2DBase
& t
) const;
96 Check that this matrix differs from @t.
99 The matrix compared with this.
101 bool operator!=(const wxAffineMatrix2DBase
& t
) const;
104 Add the translation to this matrix.
107 The translation in x direction.
109 The translation in y direction.
111 void Translate(wxDouble dx
, wxDouble dy
);
114 Add scaling to this matrix.
117 Scaling in x direction.
119 Scaling in y direction.
121 void Scale(wxDouble xScale
, wxDouble yScale
);
124 Add mirroring to this matrix.
127 The direction(s) used for mirroring. One of wxHORIZONTAL,
128 wxVERTICAL or their combination wxBOTH.
130 void Mirror(int direction
= wxHORIZONTAL
);
133 Add counter clockwise rotation to this matrix.
136 Rotation angle in radians.
138 void Rotate(wxDouble ccRadians
);
141 Applies this matrix to the point.
144 The point receiving the transformations.
146 @return The point with the transformations applied.
148 wxPoint2DDouble
TransformPoint(const wxPoint2DDouble
& p
) const;
149 void TransformPoint(wxDouble
* x
, wxDouble
* y
) const;
152 Applies the linear part of this matrix, i.e. without translation.
155 The source receiving the transformations.
157 @return The source with the transformations applied.
159 wxPoint2DDouble
TransformDistance(const wxPoint2DDouble
& p
) const;
160 void TransformDistance(wxDouble
* dx
, wxDouble
* dy
) const;