1 /*****************************************************************************
5 ** Purpose: Header file for Simple Graphics Package
6 ** Author: Kevin Rosenberg
9 ** This is part of the CTSim program
10 ** Copyright (c) 1983-2009 Kevin Rosenberg
12 ** This program is free software; you can redistribute it and/or modify
13 ** it under the terms of the GNU General Public License (version 2) as
14 ** published by the Free Software Foundation.
16 ** This program is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ** GNU General Public License for more details.
21 ** You should have received a copy of the GNU General Public License
22 ** along with this program; if not, write to the Free Software
23 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 ******************************************************************************/
26 #ifndef __H_TRANSFORMMATRIX
27 #define __H_TRANSFORMMATRIX
31 class TransformationMatrix2D {
35 TransformationMatrix2D () {};
36 TransformationMatrix2D (double m[3][3]);
39 void setTranslate (double x, double y);
40 void setScale (double sx, double sy);
41 void setShear (double shrx, double shry);
42 void setRotate (double theta);
44 double determinant () const;
46 const TransformationMatrix2D invert () const;
48 void transformPoint (double *pX, double *pY) const;
50 void print (std::ostream& ostr) const;
52 friend const TransformationMatrix2D operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs);
57 const TransformationMatrix2D operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs);