]>
Commit | Line | Data |
---|---|---|
0e5d4c38 VZ |
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 | */ | |
cb9582cd | 18 | class wxAffineMatrix2D : public wxAffineMatrix2DBase |
0e5d4c38 VZ |
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 | ||
15fa4de3 | 54 | @param t |
0e5d4c38 VZ |
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 | ||
15fa4de3 | 88 | @param t |
0e5d4c38 VZ |
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 | ||
15fa4de3 | 98 | @param t |
0e5d4c38 VZ |
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 | void Translate(wxDouble dx, wxDouble dy); | |
112 | ||
113 | /** | |
114 | Add scaling to this matrix. | |
115 | ||
116 | @param xScale | |
117 | Scaling in x direction. | |
118 | @param yScale | |
119 | Scaling in y direction. | |
120 | */ | |
121 | void Scale(wxDouble xScale, wxDouble yScale); | |
122 | ||
123 | /** | |
124 | Add mirroring to this matrix. | |
125 | ||
126 | @param direction | |
127 | The direction(s) used for mirroring. One of wxHORIZONTAL, | |
128 | wxVERTICAL or their combination wxBOTH. | |
129 | */ | |
130 | void Mirror(int direction = wxHORIZONTAL); | |
131 | ||
132 | /** | |
133 | Add counter clockwise rotation to this matrix. | |
134 | ||
135 | @param ccRadians | |
136 | Rotation angle in radians. | |
137 | */ | |
138 | void Rotate(wxDouble ccRadians); | |
139 | ||
140 | /** | |
141 | Applies this matrix to the point. | |
142 | ||
15fa4de3 | 143 | @param p |
0e5d4c38 VZ |
144 | The point receiving the transformations. |
145 | ||
146 | @return The point with the transformations applied. | |
147 | */ | |
148 | wxPoint2DDouble TransformPoint(const wxPoint2DDouble& p) const; | |
149 | void TransformPoint(wxDouble* x, wxDouble* y) const; | |
150 | ||
151 | /** | |
152 | Applies the linear part of this matrix, i.e. without translation. | |
153 | ||
15fa4de3 | 154 | @param p |
0e5d4c38 VZ |
155 | The source receiving the transformations. |
156 | ||
157 | @return The source with the transformations applied. | |
158 | */ | |
159 | wxPoint2DDouble TransformDistance(const wxPoint2DDouble& p) const; | |
160 | void TransformDistance(wxDouble* dx, wxDouble* dy) const; | |
161 | }; |