]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/affinematrix2d.h
Update new names to conform, add new event types and event attributes, etc.
[wxWidgets.git] / interface / wx / affinematrix2d.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: affinematrix2d.h
3 // Purpose: interface of wxAffineMatrix2D
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 @class wxAffineMatrix2D
10
11 A 3x2 matrix representing an affine 2D transformation.
12
13 @library{wxcore}
14 @category{misc}
15
16 @since 2.9.2
17 */
18 class wxAffineMatrix2D : public wxAffineMatrix2DBase
19 {
20 public:
21 /**
22 Default constructor.
23
24 The matrix elements are initialize to the identity matrix.
25 */
26 wxAffineMatrix2D();
27
28 /**
29 Get the component values of the matrix.
30
31 @param mat2D
32 The rotational components of the matrix (upper 2 x 2), must be
33 non-@NULL.
34 @param tr
35 The translational components of the matrix, may be @NULL.
36 */
37 void Get(wxMatrix2D* mat2D, wxPoint2DDouble* tr) const;
38
39 /**
40 Set all elements of this matrix.
41
42 @param mat2D
43 The rotational components of the matrix (upper 2 x 2).
44 @param tr
45 The translational components of the matrix.
46 */
47 void Set(const wxMatrix2D& mat2D, const wxPoint2DDouble& tr);
48
49 /**
50 Concatenate this matrix with another one.
51
52 The parameter matrix is the multiplicand.
53
54 @param t
55 The multiplicand.
56
57 @code
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 |
61 @endcode
62 */
63 void Concat(const wxAffineMatrix2DBase& t);
64
65 /**
66 Invert this matrix.
67
68 If the matrix is not invertible, i.e. if its determinant is 0, returns
69 false and doesn't modify it.
70
71 @code
72 // | m_11 m_12 0 |
73 // Invert | m_21 m_22 0 |
74 // | m_tx m_ty 1 |
75 @endcode
76 */
77 bool Invert();
78
79 /**
80 Check if this is the identity matrix.
81 */
82 bool IsIdentity() const;
83
84 //@{
85 /**
86 Check that this matrix is identical with @t.
87
88 @param t
89 The matrix compared with this.
90 */
91 void IsEqual(const wxAffineMatrix2DBase& t);
92 bool operator==(const wxAffineMatrix2DBase& t) const;
93 //@}
94
95 /**
96 Check that this matrix differs from @t.
97
98 @param t
99 The matrix compared with this.
100 */
101 bool operator!=(const wxAffineMatrix2DBase& t) const;
102
103 /**
104 Add the translation to this matrix.
105
106 @param dx
107 The translation in x direction.
108 @param dy
109 The translation in y direction.
110
111 @code
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 |
115 @endcode
116 */
117 void Translate(wxDouble dx, wxDouble dy);
118
119 /**
120 Add scaling to this matrix.
121
122 @param xScale
123 Scaling in x direction.
124 @param yScale
125 Scaling in y direction.
126
127 @code
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 |
131 @endcode
132 */
133 void Scale(wxDouble xScale, wxDouble yScale);
134
135 /**
136 Add mirroring to this matrix.
137
138 @param direction
139 The direction(s) used for mirroring. One of wxHORIZONTAL,
140 wxVERTICAL or their combination wxBOTH.
141 */
142 void Mirror(int direction = wxHORIZONTAL);
143
144 /**
145 Add clockwise rotation to this matrix.
146
147 @param cRadians
148 Rotation angle in radians, clockwise.
149
150 @code
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 |
154 @endcode
155 */
156 void Rotate(wxDouble cRadians);
157
158 /**
159 Applies this matrix to the point.
160
161 @param p
162 The point receiving the transformations.
163
164 @return The point with the transformations applied.
165
166 @code
167 // | m_11 m_12 0 |
168 // point' = | src.m_x src._my 1 | x | m_21 m_22 0 |
169 // | m_tx m_ty 1 |
170 @endcode
171 */
172 wxPoint2DDouble TransformPoint(const wxPoint2DDouble& p) const;
173 void TransformPoint(wxDouble* x, wxDouble* y) const;
174
175 /**
176 Applies the linear part of this matrix, i.e. without translation.
177
178 @param p
179 The source receiving the transformations.
180
181 @return The source with the transformations applied.
182
183 @code
184 // | m_11 m_12 0 |
185 // dist' = | src.m_x src._my 0 | x | m_21 m_22 0 |
186 // | m_tx m_ty 1 |
187 @endcode
188 */
189 wxPoint2DDouble TransformDistance(const wxPoint2DDouble& p) const;
190 void TransformDistance(wxDouble* dx, wxDouble* dy) const;
191 };