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