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