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