casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RotMatrix.h
Go to the documentation of this file.
1 //# RotMatrix.h: a 3x3 rotation matrix
2 //# Copyright (C) 1995,1996,1997,1999,2000,2001
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef CASA_ROTMATRIX_H
29 #define CASA_ROTMATRIX_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
36 #include <casacore/casa/iosfwd.h>
37 
38 namespace casacore { //# NAMESPACE CASACORE - BEGIN
39 
40 //# Forward Declarations
41 class Euler;
42 
43 //# Constants (SUN compiler does not accept non-simple default arguments)
44 
45 // <summary>
46 // A 3x3 rotation matrix
47 // </summary>
48 
49 // <use visibility=local>
50 
51 // <reviewed reviewer="tcornwel" date="1996/02/15" tests="tMeasMath" demos="">
52 // </reviewed>
53 
54 // <prerequisite>
55 // <li> <linkto class=Matrix>Matrix</linkto>
56 // <li> <linkto class=Euler>Euler</linkto>
57 // </prerequisite>
58 //
59 // <etymology>
60 // From Rotation and Matrix
61 // </etymology>
62 //
63 // <synopsis>
64 // A rotation matrix is a 3x3 matrix, which can be used to rotate a coordinate
65 // system, notably the direction cosines in
66 // <linkto class=MVDirection>MVDirection</linkto>.<br>
67 // A RotMatrix can be constructed by the default constructor (which will
68 // set the diagonal to 1), a copy constructor, and from a set of
69 // Euler angles with <src>RotMatrix(Euler)</src>.<br>
70 // Multiplication can be done (by *= and *) of two rotation matrices.<br>
71 // The (uInt, uInt) operator returns the indicated element.
72 // </synopsis>
73 //
74 // <example>
75 // See <linkto class=Euler>Euler</linkto>
76 // </example>
77 //
78 // <motivation>
79 // To use in nutation and other coordinate calculations
80 // </motivation>
81 //
82 // <todo asof="1996/02/15">
83 // </todo>
84 
85 class RotMatrix
86 {
87  public:
88 //# Friends
89 // Output a rotation matrix as a matrix
90  friend ostream &operator<< (ostream &os, const RotMatrix &rot);
91 //# Constructors
92 // Default constructor generates a unit 3x3 matrix.
93  RotMatrix();
94 // The copy constructor copies
95  RotMatrix(const RotMatrix &other);
96 // Make from an Euler
97  RotMatrix(const Euler &other);
98 // Make from an Euler around specified axes
99  RotMatrix(const Euler &other, Int ax0, Int ax1, Int ax2);
100 // Copy assignment
101  RotMatrix &operator=(const RotMatrix &other);
102 
103 // Destructor
104  ~RotMatrix();
105 
106 //# Operators
107 // The multiplication operations generate matrix products
108 // <group>
109  RotMatrix &operator*=(const RotMatrix &other);
110  RotMatrix operator*(const RotMatrix &other) const;
111 // </group>
112 
113 // Return the indicated element
114 // <group>
115  Double &operator()(uInt row, uInt column);
116  const Double &operator()(uInt row, uInt column) const;
117 // </group>
118 
119  //# Methods
120 // Get as Matrix
121  Matrix<Double> get() const;
122 
123 // Transpose the rotation matrix
124  void transpose();
125 
126 // Fill Rotation matrix from Matrix
127  void set(const Matrix<Double> &in);
128 
129 // Fill Rotation matrix from 3 (row) vectors
130  void set(const Vector<Double> &in0, const Vector<Double> &in1,
131  const Vector<Double> &in2);
132 
133  private:
134 //# Data
135 // The rotation matrix (3x3)
136  Double rotat[3][3];
137 
138 //# Member functions
139 // Apply to a rotation matrix a further rotation of angle around the specified
140 // axis which (0 or 1 or 2).
141  void applySingle(Double angle, Int which);
142 };
143 
144 
145 } //# NAMESPACE CASACORE - END
146 
147 #endif
int Int
Definition: aipstype.h:50
void set(const Matrix< Double > &in)
Fill Rotation matrix from Matrix.
RotMatrix & operator*=(const RotMatrix &other)
The multiplication operations generate matrix products.
Double rotat[3][3]
The rotation matrix (3x3)
Definition: RotMatrix.h:136
void transpose()
Transpose the rotation matrix.
A 3x3 rotation matrix.
Definition: RotMatrix.h:85
RotMatrix & operator=(const RotMatrix &other)
Copy assignment.
Double & operator()(uInt row, uInt column)
Return the indicated element.
double Double
Definition: aipstype.h:55
void applySingle(Double angle, Int which)
Apply to a rotation matrix a further rotation of angle around the specified axis which (0 or 1 or 2)...
RotMatrix()
Default constructor generates a unit 3x3 matrix.
~RotMatrix()
Destructor.
RotMatrix operator*(const RotMatrix &other) const
friend ostream & operator<<(ostream &os, const RotMatrix &rot)
Output a rotation matrix as a matrix.
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42
Vector of Euler rotation angles.
Definition: Euler.h:116