casa
$Rev:20696$
|
00001 //# RotMatrix.h: a 3x3 rotation matrix 00002 //# Copyright (C) 1995,1996,1997,1999,2000,2001 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: RotMatrix.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00027 00028 #ifndef CASA_ROTMATRIX_H 00029 #define CASA_ROTMATRIX_H 00030 00031 00032 //# Includes 00033 #include <casa/aips.h> 00034 #include <casa/Arrays/Matrix.h> 00035 #include <casa/Arrays/Vector.h> 00036 #include <casa/iosfwd.h> 00037 00038 namespace casa { //# NAMESPACE CASA - BEGIN 00039 00040 //# Forward Declarations 00041 class Euler; 00042 00043 //# Constants (SUN compiler does not accept non-simple default arguments) 00044 00045 // <summary> 00046 // A 3x3 rotation matrix 00047 // </summary> 00048 00049 // <use visibility=local> 00050 00051 // <reviewed reviewer="tcornwel" date="1996/02/15" tests="tMeasMath" demos=""> 00052 // </reviewed> 00053 00054 // <prerequisite> 00055 // <li> <linkto class=Matrix>Matrix</linkto> 00056 // <li> <linkto class=Euler>Euler</linkto> 00057 // </prerequisite> 00058 // 00059 // <etymology> 00060 // From Rotation and Matrix 00061 // </etymology> 00062 // 00063 // <synopsis> 00064 // A rotation matrix is a 3x3 matrix, which can be used to rotate a coordinate 00065 // system, notably the direction cosines in 00066 // <linkto class=MVDirection>MVDirection</linkto>.<br> 00067 // A RotMatrix can be constructed by the default constructor (which will 00068 // set the diagonal to 1), a copy constructor, and from a set of 00069 // Euler angles with <src>RotMatrix(Euler)</src>.<br> 00070 // Multiplication can be done (by *= and *) of two rotation matrices.<br> 00071 // The (uInt, uInt) operator returns the indicated element. 00072 // </synopsis> 00073 // 00074 // <example> 00075 // See <linkto class=Euler>Euler</linkto> 00076 // </example> 00077 // 00078 // <motivation> 00079 // To use in nutation and other coordinate calculations 00080 // </motivation> 00081 // 00082 // <todo asof="1996/02/15"> 00083 // </todo> 00084 00085 class RotMatrix 00086 { 00087 public: 00088 //# Friends 00089 // Output a rotation matrix as a matrix 00090 friend ostream &operator<< (ostream &os, const RotMatrix &rot); 00091 //# Constructors 00092 // Default constructor generates a unit 3x3 matrix. 00093 RotMatrix(); 00094 // The copy constructor copies 00095 RotMatrix(const RotMatrix &other); 00096 // Make from an Euler 00097 RotMatrix(const Euler &other); 00098 // Make from an Euler around specified axes 00099 RotMatrix(const Euler &other, Int ax0, Int ax1, Int ax2); 00100 // Copy assignment 00101 RotMatrix &operator=(const RotMatrix &other); 00102 00103 // Destructor 00104 ~RotMatrix(); 00105 00106 //# Operators 00107 // The multiplication operations generate matrix products 00108 // <group> 00109 RotMatrix &operator*=(const RotMatrix &other); 00110 RotMatrix operator*(const RotMatrix &other) const; 00111 // </group> 00112 00113 // Return the indicated element 00114 // <group> 00115 Double &operator()(uInt row, uInt column); 00116 const Double &operator()(uInt row, uInt column) const; 00117 // </group> 00118 00119 //# Methods 00120 // Get as Matrix 00121 Matrix<Double> get() const; 00122 00123 // Transpose the rotation matrix 00124 void transpose(); 00125 00126 // Fill Rotation matrix from Matrix 00127 void set(const Matrix<Double> &in); 00128 00129 // Fill Rotation matrix from 3 (row) vectors 00130 void set(const Vector<Double> &in0, const Vector<Double> &in1, 00131 const Vector<Double> &in2); 00132 00133 private: 00134 //# Data 00135 // The rotation matrix (3x3) 00136 Double rotat[3][3]; 00137 00138 //# Member functions 00139 // Apply to a rotation matrix a further rotation of angle around the specified 00140 // axis which (0 or 1 or 2). 00141 void applySingle(Double angle, Int which); 00142 }; 00143 00144 00145 } //# NAMESPACE CASA - END 00146 00147 #endif