X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/555526fbff27722462383e12e72b7adc84423540..ca77701441e39245dcbfce903049e76f166979e5:/include/wx/matrix.h diff --git a/include/wx/matrix.h b/include/wx/matrix.h index 0cbeb2ba0d..da6c5da78f 100644 --- a/include/wx/matrix.h +++ b/include/wx/matrix.h @@ -1,23 +1,20 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: matrix.h -// Purpose: wxTransformMatrix class. NOT YET USED -//! Author: Chris Breeze, Julian Smart +// Name: wx/matrix.h +// Purpose: wxTransformMatrix class. NOT YET USED +// Author: Chris Breeze, Julian Smart // Modified by: Klaas Holwerda -// Created: 01/02/97 -// RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows licence +// Created: 01/02/97 +// RCS-ID: $Id$ +// Copyright: (c) Julian Smart, Chris Breeze +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_MATRIXH__ #define _WX_MATRIXH__ -#ifdef __GNUG__ -#pragma interface "matrix.h" -#endif - //! headerfiles="matrix.h wx/object.h" #include "wx/object.h" +#include "wx/math.h" //! codefiles="matrix.cpp" @@ -27,15 +24,15 @@ // Note: this is intended to be used in wxDC at some point to replace // the current system of scaling/translation. It is not yet used. -//:defenition +//:definition // A 3x3 matrix to do 2D transformations. -// It can be used to map data to window coordinates. -// But also for manipulating your own data. +// It can be used to map data to window coordinates, +// and also for manipulating your own data. // For example drawing a picture (composed of several primitives) // at a certain coordinate and angle within another parent picture. // At all times m_isIdentity is set if the matrix itself is an Identity matrix. // It is used where possible to optimize calculations. -class WXDLLEXPORT wxTransformMatrix: public wxObject +class WXDLLIMPEXP_CORE wxTransformMatrix: public wxObject { public: wxTransformMatrix(void); @@ -52,8 +49,8 @@ public: void SetValue(int col, int row, double value); void operator = (const wxTransformMatrix& mat); - bool operator == (const wxTransformMatrix& mat); - bool operator != (const wxTransformMatrix& mat); + bool operator == (const wxTransformMatrix& mat) const; + bool operator != (const wxTransformMatrix& mat) const; //multiply every element by t wxTransformMatrix& operator*=(const double& t); @@ -97,7 +94,7 @@ public: // Is the matrix the identity matrix? // Only returns a flag, which is set whenever an operation // is done. - inline bool IsIdentity(void) const { return m_isIdentity; }; + inline bool IsIdentity(void) const { return m_isIdentity; } // This does an actual check. inline bool IsIdentity1(void) const ; @@ -123,7 +120,6 @@ public: //!code: matrix' = | 0 -1 0 | x matrix //!code: | 0 0 1 | wxTransformMatrix& Mirror(bool x=true, bool y=false); - // Translate by dx, dy: //!ex: //!code: | 1 0 dx | @@ -219,15 +215,15 @@ inline double wxTransformMatrix::TransformY(double y) const inline bool wxTransformMatrix::IsIdentity1(void) const { return - (m_matrix[0][0] == 1.0 && - m_matrix[1][1] == 1.0 && - m_matrix[2][2] == 1.0 && - m_matrix[1][0] == 0.0 && - m_matrix[2][0] == 0.0 && - m_matrix[0][1] == 0.0 && - m_matrix[2][1] == 0.0 && - m_matrix[0][2] == 0.0 && - m_matrix[1][2] == 0.0) ; + ( wxIsSameDouble(m_matrix[0][0], 1.0) && + wxIsSameDouble(m_matrix[1][1], 1.0) && + wxIsSameDouble(m_matrix[2][2], 1.0) && + wxIsSameDouble(m_matrix[1][0], 0.0) && + wxIsSameDouble(m_matrix[2][0], 0.0) && + wxIsSameDouble(m_matrix[0][1], 0.0) && + wxIsSameDouble(m_matrix[2][1], 0.0) && + wxIsSameDouble(m_matrix[0][2], 0.0) && + wxIsSameDouble(m_matrix[1][2], 0.0) ); } // Calculates the determinant of a 2 x 2 matrix @@ -236,5 +232,4 @@ inline double wxCalculateDet(double a11, double a21, double a12, double a22) return a11 * a22 - a12 * a21; } -#endif - // _WX_MATRIXH__ +#endif // _WX_MATRIXH__