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-2000 Kevin Rosenberg
12 ** $Id: transformmatrix.h,v 1.3 2000/12/15 23:48:25 kevin Exp $
14 ** This program is free software; you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License (version 2) as
16 ** published by the Free Software Foundation.
18 ** This program is distributed in the hope that it will be useful,
19 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ** GNU General Public License for more details.
23 ** You should have received a copy of the GNU General Public License
24 ** along with this program; if not, write to the Free Software
25 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 ******************************************************************************/
28 #ifndef __H_TRANSFORMMATRIX
29 #define __H_TRANSFORMMATRIX
33 class TransformationMatrix2D {
37 TransformationMatrix2D () {};
38 TransformationMatrix2D (double m[3][3]);
41 void setTranslate (double x, double y);
42 void setScale (double sx, double sy);
43 void setShear (double shrx, double shry);
44 void setRotate (double theta);
46 double determinant () const;
48 const TransformationMatrix2D invert () const;
50 void transformPoint (double *pX, double *pY) const;
52 void print (std::ostream& ostr) const;
54 friend const TransformationMatrix2D operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs);
59 const TransformationMatrix2D operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs);