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.1 2000/07/28 08:28:08 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
32 class TransformationMatrix2D {
36 TransformationMatrix2D () {};
37 TransformationMatrix2D (double m[3][3]);
40 void setTranslate (double x, double y);
41 void setScale (double sx, double sy);
42 void setShear (double shrx, double shry);
43 void setRotate (double theta);
45 double determinant () const;
47 const TransformationMatrix2D invert () const;
49 void transformPoint (double *pX, double *pY) const;
51 void print (ostream& ostr) const;
53 friend const TransformationMatrix2D operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs);
58 const TransformationMatrix2D operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs);