]>
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
: public wxAffineMatrix2DBase
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.
112 // | 1 0 0 | | m_11 m_12 0 |
113 // matrix' = | 0 1 0 | x | m_21 m_22 0 |
114 // | dx dy 1 | | m_tx m_ty 1 |
117 void Translate(wxDouble dx
, wxDouble dy
);
120 Add scaling to this matrix.
123 Scaling in x direction.
125 Scaling in y direction.
128 // | xScale 0 0 | | m_11 m_12 0 |
129 // matrix' = | 0 yScale 0 | x | m_21 m_22 0 |
130 // | 0 0 1 | | m_tx m_ty 1 |
133 void Scale(wxDouble xScale
, wxDouble yScale
);
136 Add mirroring to this matrix.
139 The direction(s) used for mirroring. One of wxHORIZONTAL,
140 wxVERTICAL or their combination wxBOTH.
142 void Mirror(int direction
= wxHORIZONTAL
);
145 Add clockwise rotation to this matrix.
148 Rotation angle in radians, clockwise.
151 // | cos sin 0 | | m_11 m_12 0 |
152 // matrix' = | -sin cos 0 | x | m_21 m_22 0 |
153 // | 0 0 1 | | m_tx m_ty 1 |
156 void Rotate(wxDouble cRadians
);
159 Applies this matrix to the point.
162 The point receiving the transformations.
164 @return The point with the transformations applied.
168 // point' = | src.m_x src._my 1 | x | m_21 m_22 0 |
172 wxPoint2DDouble
TransformPoint(const wxPoint2DDouble
& p
) const;
173 void TransformPoint(wxDouble
* x
, wxDouble
* y
) const;
176 Applies the linear part of this matrix, i.e.\ without translation.
179 The source receiving the transformations.
181 @return The source with the transformations applied.
185 // dist' = | src.m_x src._my 0 | x | m_21 m_22 0 |
189 wxPoint2DDouble
TransformDistance(const wxPoint2DDouble
& p
) const;
190 void TransformDistance(wxDouble
* dx
, wxDouble
* dy
) const;