casacore
Loading...
Searching...
No Matches
Euler.h
Go to the documentation of this file.
1// # Euler.h: Vector of Euler rotation angles
2// # Copyright (C) 1995,1996,1997,1998,1999
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_EULER_H
27#define CASA_EULER_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/Quanta/Quantum.h>
33#include <utility>
34
35namespace casacore { // # NAMESPACE CASACORE - BEGIN
36
37// # Forward Declarations
38
39// <summary>
40// Vector of Euler rotation angles
41// </summary>
42
43// <use visibility=local>
44
45// <reviewed reviewer="tcornwel" date="1996/02/15" tests="tMeasMath" demos="">
46// </reviewed>
47
48// <prerequisite>
49// <li> <linkto class=Vector>Vector</linkto> class
50// <li> <linkto class=Quantum>Quantum</linkto> class for units
51// <li> <linkto class=RotMatrix>RotMatrix</linkto> class for usage
52// </prerequisite>
53//
54// <etymology>
55// Euler angles describe the rotation of a coordinate system
56// </etymology>
57//
58// <synopsis>
59// The Euler class is a vector of three angles, together with a vector of
60// three signed integers. The angles describe the rotation around an axis of a
61// coordinate system, the integers the actual axis around which to rotate.
62// The integer can be 0 (do not use this angle) or 1,2,3 to indicate the
63// axis.
64// Given angles (a1,a2,a3) and axes (i1,i2,i3), the actual rotation matrix
65// constructed will be:<br>
66// R = R<sub>i3</sub>(a3).R<sub>i2</sub>(a2).R<sub>i1</sub>(a1) <br>
67// It has the following constructors:
68// <ul>
69// <li> Euler() creates a zero filled vector of length 3. Axes: (1,2,3)
70// <li> Euler(Euler) creates a copy
71// <li> Euler(Double, uInt, Double=0, uInt=0, Double=0, uInt=0) creates an
72// Euler with specified values
73// <li> Euler(Double, Double=0, Double=0) creates an Euler with (1,2,3)
74// <li> Euler(Quantity, uInt, Quantity=0, uInt=0, Quantity=0, uInt=0) creates
75// an Euler with specified values
76// <li> Euler(Quantity, Quantity=0, Quantity=0) creates an Euler with
77// interpretation of angle units in the Quantities
78// <li> Euler(<src>Quantum<Vector<Double> ></src>) creates a zero expanded
79// Euler from at most the first three elements of Quantity
80// vector; with (1,2,3)
81// <li> Euler(<src>Quantum<Vector<Double> >, Vector<uInt></src>) creates a
82// zero expanded Euler with given values
83// </ul>
84// It has a unary minus operator, which reverses the sign and order of the
85// three angles, and the order of the axes, to produce the Euler angles
86// for a rotation with opposite signs, so that <src>RotMatrix(-Euler)</src>
87// will generate the inverse rotation matrix as compared with
88// <src>RotMatrix(Euler)</src>.<br>
89// getAngle() functions return the Euler angles as a Quantum vector.<br>
90// Eulers have addition and subtraction (on the angles). Note that this
91// produces the correct angles for a combined rotation only if the
92// axes are identical.<br>
93// A (which) operator returns the indicated angle. Set/get functions
94// manipulate the axes.
95// </synopsis>
96//
97// <example>
98// <srcblock>
99// Quantity angle(25,"deg"); // 25 degrees
100// Euler eul(angle.get().getValue(),2); // rotate over axis 2 (radians)
101// RotMatrix rot(eul); // generates rotation matrix
102// </srcblock>
103// </example>
104//
105// <motivation>
106// To use generated precession and nutation results
107// </motivation>
108//
109// <todo asof="1995/09/04">
110// </todo>
111
112class Euler {
113 public:
114 // # Friends
115 // Output Euler angles
116 friend ostream &operator<<(ostream &os, const Euler &eul);
117
118 // # Constructors
119 // Default constructor generates zero filled Double vector of length 3, with
120 // (1,2,3) axes
122 // Copy constructor
123 Euler(const Euler &other);
124 // Copy assignment
125 Euler &operator=(const Euler &other);
126 // Constructs an Euler with specified angles and (1,2,3) axes
127 Euler(Double in0, Double in1 = 0, Double in2 = 0);
128 // Constructs an Euler with specified angles and axes
129 Euler(Double in0, uInt ax0, Double in1 = 0, uInt ax1 = 0, Double in2 = 0, uInt ax2 = 0);
130 // <thrown>
131 // <li> AipsError if non-angle units used
132 // </thrown>
133 // Constructs an Euler from specified angle quantities
134 // <group>
135 Euler(const Quantity &in0);
136 Euler(const Quantity &in0, const Quantity &in1);
137 Euler(const Quantity &in0, const Quantity &in1, const Quantity &in2);
138 Euler(const Quantity &in0, uInt ax0);
139 Euler(const Quantity &in0, uInt ax0, const Quantity &in1, uInt ax1 = 0);
140 Euler(const Quantity &in0, uInt ax0, const Quantity &in1, uInt ax1, const Quantity &in2,
141 uInt ax2 = 0);
142 // Constructs an Euler (zero filled) from elements of Quantity vector
143 // <group>
145 Euler(const Quantum<Vector<Double>> &in, const Vector<uInt> &ax);
146 // </group>
147 // </group>
148
149 // Destructor
151
152 // # Operators
153 // The unary minus reverses the sign and order of the Euler angles
155 // Addition and subtraction
156 // <group>
157 Euler &operator+=(const Euler &right);
158 Euler operator+(const Euler &right) const;
159 Euler &operator-=(const Euler &right);
160 Euler operator-(const Euler &right) const;
161 // </group>
162 // Return the which' angle
163 // <group>
165 const Double &operator()(uInt which) const;
166 // </group>
167
168 // # General Member Functions
169 // with the optional conversion units.
170 // <group>
173 // </group>
174
175 // Set an axis
176 void set(uInt which, uInt ax);
177
178 // Set all axes
179 void set(uInt ax0, uInt ax1, uInt ax2);
180
181 // Get an axis
182 Int get(uInt which) const;
183
184 private:
185 // # Data
186 // vector with 3 Euler angles (data.first)
188 // Axes (data.second)
190
191 // # Private Member Functions
192 // The makeRad functions check and convert the input Quantities to radians
193 // <group>
194 static Double makeRad(const Quantity &in);
196 // </group>
197};
198
199} // namespace casacore
200
201#endif
Euler(Double in0, uInt ax0, Double in1=0, uInt ax1=0, Double in2=0, uInt ax2=0)
Constructs an Euler with specified angles and axes.
Euler(Double in0, Double in1=0, Double in2=0)
Constructs an Euler with specified angles and (1,2,3) axes.
Vector< Double > euler
vector with 3 Euler angles (data.first)
Definition Euler.h:187
Euler & operator=(const Euler &other)
Copy assignment.
Euler(const Quantity &in0)
friend ostream & operator<<(ostream &os, const Euler &eul)
Output Euler angles.
Quantum< Vector< Double > > getAngle(const Unit &unit) const
Euler(const Quantity &in0, const Quantity &in1, const Quantity &in2)
Euler & operator-=(const Euler &right)
Euler operator-() const
The unary minus reverses the sign and order of the Euler angles.
Euler operator+(const Euler &right) const
Euler(const Euler &other)
Copy constructor.
~Euler()
Destructor.
void set(uInt ax0, uInt ax1, uInt ax2)
Set all axes.
Vector< Int > axes
Axes (data.second).
Definition Euler.h:189
void set(uInt which, uInt ax)
Set an axis.
Int get(uInt which) const
Get an axis.
Euler(const Quantity &in0, const Quantity &in1)
static Double makeRad(const Quantity &in)
The makeRad functions check and convert the input Quantities to radians.
Euler(const Quantity &in0, uInt ax0, const Quantity &in1, uInt ax1, const Quantity &in2, uInt ax2=0)
Euler(const Quantum< Vector< Double > > &in)
Constructs an Euler (zero filled) from elements of Quantity vector.
static Vector< Double > makeRad(const Quantum< Vector< Double > > &in)
Euler(const Quantity &in0, uInt ax0, const Quantity &in1, uInt ax1=0)
Euler(const Quantum< Vector< Double > > &in, const Vector< uInt > &ax)
Euler operator-(const Euler &right) const
Quantum< Vector< Double > > getAngle() const
with the optional conversion units.
Euler(const Quantity &in0, uInt ax0)
Double & operator()(uInt which)
Return the which' angle.
const Double & operator()(uInt which) const
Euler & operator+=(const Euler &right)
Addition and subtraction.
Euler()
Default constructor generates zero filled Double vector of length 3, with (1,2,3) axes.
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
Quantum< Double > Quantity
Definition Quantum.h:40
double Double
Definition aipstype.h:53