casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef CASA_ROTMATRIX_H
27#define CASA_ROTMATRIX_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Matrix.h>
32#include <casacore/casa/Arrays/Vector.h>
33#include <casacore/casa/iosfwd.h>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38class Euler;
39
40// # Constants (SUN compiler does not accept non-simple default arguments)
41
42// <summary>
43// A 3x3 rotation matrix
44// </summary>
45
46// <use visibility=local>
47
48// <reviewed reviewer="tcornwel" date="1996/02/15" tests="tMeasMath" demos="">
49// </reviewed>
50
51// <prerequisite>
52// <li> <linkto class=Matrix>Matrix</linkto>
53// <li> <linkto class=Euler>Euler</linkto>
54// </prerequisite>
55//
56// <etymology>
57// From Rotation and Matrix
58// </etymology>
59//
60// <synopsis>
61// A rotation matrix is a 3x3 matrix, which can be used to rotate a coordinate
62// system, notably the direction cosines in
63// <linkto class=MVDirection>MVDirection</linkto>.<br>
64// A RotMatrix can be constructed by the default constructor (which will
65// set the diagonal to 1), a copy constructor, and from a set of
66// Euler angles with <src>RotMatrix(Euler)</src>.<br>
67// Multiplication can be done (by *= and *) of two rotation matrices.<br>
68// The (uInt, uInt) operator returns the indicated element.
69// </synopsis>
70//
71// <example>
72// See <linkto class=Euler>Euler</linkto>
73// </example>
74//
75// <motivation>
76// To use in nutation and other coordinate calculations
77// </motivation>
78//
79// <todo asof="1996/02/15">
80// </todo>
81
82class RotMatrix {
83 public:
84 // # Friends
85 // Output a rotation matrix as a matrix
86 friend ostream &operator<<(ostream &os, const RotMatrix &rot);
87 // # Constructors
88 // Default constructor generates a unit 3x3 matrix.
90 // The copy constructor copies
91 RotMatrix(const RotMatrix &other);
92 // Make from an Euler
93 RotMatrix(const Euler &other);
94 // Make from an Euler around specified axes
95 RotMatrix(const Euler &other, Int ax0, Int ax1, Int ax2);
96 // Copy assignment
98
99 // Destructor
101
102 // # Operators
103 // The multiplication operations generate matrix products
104 // <group>
106 RotMatrix operator*(const RotMatrix &other) const;
107 // </group>
108
109 // Return the indicated element
110 // <group>
111 Double &operator()(uInt row, uInt column);
112 const Double &operator()(uInt row, uInt column) const;
113 // </group>
114
115 // # Methods
116 // Get as Matrix
118
119 // Transpose the rotation matrix
120 void transpose();
121
122 // Fill Rotation matrix from Matrix
123 void set(const Matrix<Double> &in);
124
125 // Fill Rotation matrix from 3 (row) vectors
126 void set(const Vector<Double> &in0, const Vector<Double> &in1, const Vector<Double> &in2);
127
128 private:
129 // # Data
130 // The rotation matrix (3x3)
132
133 // # Member functions
134 // Apply to a rotation matrix a further rotation of angle around the specified
135 // axis which (0 or 1 or 2).
136 void applySingle(Double angle, Int which);
137};
138
139} // namespace casacore
140
141#endif
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.
void transpose()
Transpose the rotation matrix.
friend ostream & operator<<(ostream &os, const RotMatrix &rot)
Output a rotation matrix as a matrix.
void set(const Vector< Double > &in0, const Vector< Double > &in1, const Vector< Double > &in2)
Fill Rotation matrix from 3 (row) vectors.
Matrix< Double > get() const
Get as Matrix.
const Double & operator()(uInt row, uInt column) const
RotMatrix & operator*=(const RotMatrix &other)
The multiplication operations generate matrix products.
Double & operator()(uInt row, uInt column)
Return the indicated element.
Double rotat[3][3]
The rotation matrix (3x3).
Definition RotMatrix.h:131
void set(const Matrix< Double > &in)
Fill Rotation matrix from Matrix.
RotMatrix(const Euler &other)
Make from an Euler.
~RotMatrix()
Destructor.
RotMatrix(const Euler &other, Int ax0, Int ax1, Int ax2)
Make from an Euler around specified axes.
RotMatrix & operator=(const RotMatrix &other)
Copy assignment.
RotMatrix operator*(const RotMatrix &other) const
RotMatrix(const RotMatrix &other)
The copy constructor copies.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
double Double
Definition aipstype.h:53