r7061: initial property settings
[ctsim.git] / include / transformmatrix.h
1 /*****************************************************************************
2 ** FILE IDENTIFICATION
3 **
4 **      Name:         sgp.h
5 **      Purpose:      Header file for Simple Graphics Package
6 **      Author:       Kevin Rosenberg
7 **      Date Started: 1984
8 **
9 **  This is part of the CTSim program
10 **  Copyright (c) 1983-2001 Kevin Rosenberg
11 **
12 **  $Id$
13 **
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.
17 **
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.
22 **
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 ******************************************************************************/
27
28 #ifndef __H_TRANSFORMMATRIX
29 #define __H_TRANSFORMMATRIX
30
31 #include <iostream>
32
33 class TransformationMatrix2D {
34 public:
35   double mtx[3][3];
36
37   TransformationMatrix2D () {};
38   TransformationMatrix2D (double m[3][3]);
39
40   void setIdentity();
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);
45
46   double determinant () const;
47
48   const TransformationMatrix2D invert () const;
49
50   void transformPoint (double *pX, double *pY) const;
51
52   void print (std::ostream& ostr) const;
53
54   friend const TransformationMatrix2D operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs);
55
56 };
57
58
59 const TransformationMatrix2D  operator* (const TransformationMatrix2D& lhs, const TransformationMatrix2D& rhs);
60
61 #endif