Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

matrix3.h

00001 //
00002 // matrix3.h
00003 //
00004 // Copyright (C) 1996 Limit Point Systems, Inc.
00005 //
00006 // Author: Curtis Janssen <cljanss@limitpt.com>
00007 // Maintainer: LPS
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
00026 //
00027 
00028 #ifndef _math_scmat_matrix3_h
00029 #define _math_scmat_matrix3_h
00030 #ifdef __GNUC__
00031 #pragma interface
00032 #endif
00033 
00034 #include <iostream>
00035 #include <math.h>
00036 
00037 #include <math/scmat/vector3.h>
00038 class RefSCmatrix;
00039 
00040 class SCMatrix3
00041 {
00042   private:
00043     double _m[9];
00044   public:
00045     SCMatrix3() {}
00046     SCMatrix3(const SCMatrix3&);
00047 #if 0
00048     SCMatrix3(const RefSCMatrix3&);
00049 #endif
00050     SCMatrix3(double x[9]);
00051     SCMatrix3(const SCVector3&p1, const SCVector3&p2, const SCVector3&p3);
00052     ~SCMatrix3() {}
00053     SCMatrix3& operator=(const SCMatrix3&);
00054     SCMatrix3 operator*(double) const;
00055     SCMatrix3 operator*(const SCMatrix3&) const;
00056     SCVector3 operator*(const SCVector3&v) const {
00057         SCVector3 result;
00058         result._v[0] = _m[0+3*0]*v._v[0]+_m[0+3*1]*v._v[1]+_m[0+3*2]*v._v[2];
00059         result._v[1] = _m[1+3*0]*v._v[0]+_m[1+3*1]*v._v[1]+_m[1+3*2]*v._v[2];
00060         result._v[2] = _m[2+3*0]*v._v[0]+_m[2+3*1]*v._v[1]+_m[2+3*2]*v._v[2];
00061         return result;
00062       }
00063     SCMatrix3 operator+(const SCMatrix3&) const;
00064     SCMatrix3 operator-(const SCMatrix3&) const;
00065     double& elem(int i, int j) { return _m[i+3*j]; }
00066     const double& elem(int i, int j) const { return _m[i+3*j]; }
00067     double& elem(int i) { return _m[i]; }
00068     const double& elem(int i) const { return _m[i]; }
00069     double& operator[] (int i) { return _m[i]; }
00070     const double& operator[] (int i) const { return _m[i]; }
00071     double& operator() (int i, int j) { return _m[i+3*j]; }
00072     const double& operator() (int i, int j) const { return _m[i+3*j]; }
00073     const double* data() const { return _m; }
00074     void print(std::ostream& =ExEnv::out()) const;
00075 };
00076 SCMatrix3 operator*(double,const SCMatrix3&);
00077 SCMatrix3 rotation_mat(const SCVector3&, const SCVector3&, double theta);
00078 SCMatrix3 rotation_mat(const SCVector3&, const SCVector3&);
00079 SCMatrix3 rotation_mat(const SCVector3&, double theta);
00080 SCMatrix3 reflection_mat(const SCVector3&);
00081 inline int delta(int i, int j) { return i==j; }
00082 
00083 #endif
00084 
00085 // Local Variables:
00086 // mode: c++
00087 // c-file-style: "CLJ"
00088 // End:

Generated at Thu Oct 4 18:08:45 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.