]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/affinematrix2dbase.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: affinematrix2dbase.h
3 // Purpose: wxMatrix2D documentation
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 A simple container for 2x2 matrix.
13 This simple structure is used with wxAffineMatrix2D.
25 Initializes the matrix elements to the identity.
27 wxMatrix2D(wxDouble v11
= 1,
32 /// The matrix elements in the usual mathematical notation.
33 wxDouble m_11
, m_12
, m_21
, m_22
;
38 @class wxAffineMatrix2DBase
40 A 2x3 matrix representing an affine 2D transformation.
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.
50 class wxAffineMatrix2DBase
56 The matrix elements are initialize to the identity matrix.
58 wxAffineMatrix2DBase();
59 virtual ~wxAffineMatrix2DBase();
62 Set all elements of this matrix.
65 The rotational components of the matrix (upper 2 x 2).
67 The translational components of the matrix.
69 virtual void Set(const wxMatrix2D
& mat2D
, const wxPoint2DDouble
& tr
) = 0;
72 Get the component values of the matrix.
75 The rotational components of the matrix (upper 2 x 2), must be
78 The translational components of the matrix, may be @NULL.
80 virtual void Get(wxMatrix2D
* mat2D
, wxPoint2DDouble
* tr
) const = 0;
83 Concatenate this matrix with another one.
85 The parameter matrix is the multiplicand.
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 |
96 virtual void Concat(const wxAffineMatrix2DBase
& t
) = 0;
101 If the matrix is not invertible, i.e. if its determinant is 0, returns
102 false and doesn't modify it.
106 // Invert | m_21 m_22 0 |
110 virtual bool Invert() = 0;
113 Check if this is the identity matrix.
115 virtual bool IsIdentity() const = 0;
119 Check that this matrix is identical with @t.
122 The matrix compared with this.
124 virtual bool IsEqual(const wxAffineMatrix2DBase
& t
) const = 0;
125 bool operator==(const wxAffineMatrix2DBase
& t
) const;
129 Check that this matrix differs from @t.
132 The matrix compared with this.
134 bool operator!=(const wxAffineMatrix2DBase
& t
) const;
139 Add the translation to this matrix.
142 The translation in x direction.
144 The translation in y direction.
146 virtual void Translate(wxDouble dx
, wxDouble dy
) = 0;
149 Add scaling to this matrix.
152 Scaling in x direction.
154 Scaling in y direction.
156 virtual void Scale(wxDouble xScale
, wxDouble yScale
) = 0;
159 Add counter clockwise rotation to this matrix.
162 Rotation angle in radians.
164 virtual void Rotate(wxDouble ccRadians
) = 0;
167 Add mirroring to this matrix.
170 The direction(s) used for mirroring. One of wxHORIZONTAL,
171 wxVERTICAL or their combination wxBOTH.
173 void Mirror(int direction
= wxHORIZONTAL
);
177 Applies this matrix to the point.
180 The point receiving the transformations.
182 @return The point with the transformations applied.
184 wxPoint2DDouble
TransformPoint(const wxPoint2DDouble
& src
) const;
185 void TransformPoint(wxDouble
* x
, wxDouble
* y
) const;
188 Applies the linear part of this matrix, i.e. without translation.
191 The source receiving the transformations.
193 @return The source with the transformations applied.
195 wxPoint2DDouble
TransformDistance(const wxPoint2DDouble
& src
) const;
196 void TransformDistance(wxDouble
* dx
, wxDouble
* dy
) const;