Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

matrix.cc

Go to the documentation of this file.
00001 
00002 // Flash Plugin and Player
00003 // Copyright (C) 1998,1999 Olivier Debon
00004 // 
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 // 
00020 //  Author : Olivier Debon  <odebon@club-internet.fr>
00021 //  
00022 
00023 #include "matrix.h"
00024 
00025 #ifdef RCSID
00026 static char *rcsid = "$Id: matrix.cc,v 1.1.1.1 2002/01/25 22:14:58 kergoth Exp $";
00027 #endif
00028 
00029 Matrix::Matrix()
00030 {
00031         a = 1.0;
00032         d = 1.0;
00033         b = c = 0.0;
00034         tx = ty = 0;
00035 }
00036 
00037 Matrix Matrix::operator*(Matrix m)
00038 {
00039         Matrix mat;
00040 
00041         mat.a = this->a * m.a + this->b * m.c;
00042         mat.b = this->a * m.b + this->b * m.d;
00043         mat.c = this->c * m.a + this->d * m.c;
00044         mat.d = this->c * m.b + this->d * m.d;
00045 
00046         mat.tx = this->getX(m.tx,m.ty);
00047         mat.ty = this->getY(m.tx,m.ty);
00048 
00049         return mat;
00050 }
00051 
00052 Matrix Matrix::invert()
00053 {
00054         Matrix mat;
00055         float det;
00056 
00057         det = a*d-b*c;
00058 
00059         mat.a  = d/det;
00060         mat.b  = -b/det;
00061         mat.c  = -c/det;
00062         mat.d  = a/det;
00063 
00064         mat.tx = - (long)(mat.a * tx + mat.b * ty);
00065         mat.ty = - (long)(mat.c * tx + mat.d * ty);
00066 
00067         return mat;
00068 }

Generated on Sat Nov 5 16:15:35 2005 for OPIE by  doxygen 1.4.2