casacore
Loading...
Searching...
No Matches
MVuvw.h
Go to the documentation of this file.
1// # MVuvw.h: A 3D vector on Earth
2// # Copyright (C) 1998,2000
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_MVUVW_H
27#define CASA_MVUVW_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Quanta/MVPosition.h>
32
33namespace casacore { // # NAMESPACE CASACORE - BEGIN
34
35// # Forward Declarations
36class MVDirection;
37class MVBaseline;
38
39// <summary> A 3D vector on Earth </summary>
40
41// <use visibility=export>
42
43// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMuvw" demos="">
44// </reviewed>
45
46// <prerequisite>
47// <li> <linkto class=MeasValue>MeasValue</linkto>
48// </prerequisite>
49//
50// <etymology>
51// From Measure, Value and uvw
52// </etymology>
53//
54// <synopsis>
55// A MVuvw is a 3-vector of uvws in a rectangular frame with
56// internal units of m.<br>
57// It can be constructed with:
58// <ul>
59// <li> MVuvw() creates point at origin (0,0,0)
60// <li> MVuvw(MVuvw) creates a copy
61// <li> MVuvw(MVPosition) creates (x,y,z) from the given position
62// <li> MVuvw(Double, Double, Double) creates (x,y,z) with
63// specified values (assuming meters)
64// <li> MVuvw(Quantity length,Double, Double) creates a MVuvw assuming
65// that the two values are (in radians) angle along 'equator'
66// and towards 'pole'.
67// <li> MVuvw(Quantity length, Quantity, Quantity) creates a MVuvw
68// assuming angles as in previous, or uvws
69// <li> <src>MVuvw(Quantity, Quantum<Vector<Double> >)</src> creates a
70// MVuvw from angle vector, using first two angles, and
71// assuming second as zero if not present.
72// <li> <src>MVuvw(Quantum<Vector<Double> ></src> creates from
73// angles or uvws, depending on the units in the
74// quantum vector. In the angle case,
75// the data derived can be scaled with the readjust() function. If
76// the unit of the quantum vector is length, uvw is
77// assumed.
78// <li> <src>MVuvw(Vector<Double></src> creates from angles (less than
79// or equal to two elements) or x,y,z (3 elements).
80// <li> <src>MVuvw(Vector<Quantity></src> creates from length+angles,
81// angles, or x,y,z, depending on units.
82// <li> <src>MVuvw(MVBaseline, MVDirection)</src> creates a uvw
83// in the specified reference direction (in same reference frame)
84// </ul>
85// A void adjust(Double) function normalises the vector to a length of 1;
86// a get() returns as a
87// Double 3-vector the length and angles of the uvw vector;
88// a getAngle() returns a Quantum 2-vector, (uInt) returns the indicated
89// element, and getValue returns the vector.<br>
90// uvws can be added and subtracted.<br>
91// The multiplication of two uvws produces the in-product.<br>
92// </synopsis>
93//
94// <example>
95// See <linkto class=Muvw>Muvw</linkto> class.
96// </example>
97//
98// <motivation>
99// To do coordinate transformations
100// </motivation>
101//
102// <todo asof="1998/04/20">
103// <li> Implement for EW
104// <li> Get sign (especially of V) correct
105// <li> Let it handle Vectors of UVW
106// <li> Add some rotation matrix history for speed
107// </todo>
108
109class MVuvw : public MVPosition {
110 public:
111 // # Friends
112
113 // # Constructors
114 // Default constructor generates a (0,0,0) uvw
116 // Creates from an MVPosition
117 MVuvw(const MVPosition &other);
118 // Creates a specified vector
119 MVuvw(Double in0, Double in1, Double in2);
120 // Creates a vector with specified length towards pole
121 // <group>
122 explicit MVuvw(Double in0);
123 MVuvw(const Quantity &l);
124 // </group>
125 // Creates the uvw from specified (azimuth,elevation) angles and length
126 MVuvw(const Quantity &l, Double angle0, Double angle1);
127 // Creates the uvw from specified angles and length. or uvws
128 // <thrown>
129 // <li> AipsError if quantities not in angle format
130 // </thrown>
131 // <group>
132 MVuvw(const Quantity &l, const Quantity &angle0, const Quantity &angle1);
133 // If not enough angles: pole assumed (if none), or elevation =0 (if 1)
135 MVuvw(const Quantity &l, const Quantum<Vector<Double>> &angle);
136 // </group>
137 // Create from specified length and/or angles and/or uvw
138 // <group>
139 MVuvw(const Vector<Double> &other);
140 MVuvw(const Vector<Quantity> &other);
141 // </group>
142 // uvw from a baseline and a reference direction (in same frame)
143 // <group>
144 MVuvw(const MVBaseline &pos, const MVDirection &dr, Bool ew = False);
145 // </group>
146
147 // # Operators
148 // Multiplication defined as in-product
149 // <group>
150 Double operator*(const MVuvw &other) const;
151 // </group>
152
153 // Equality comparisons
154 // <group>
155 Bool operator==(const MVuvw &other) const;
156 Bool operator!=(const MVuvw &other) const;
157 Bool near(const MVuvw &other, Double tol = 1e-13) const;
158 Bool near(const MVuvw &other, Quantity tol) const;
159 Bool nearAbs(const MVuvw &other, Double tol = 1e-13) const;
160 // </group>
161
162 // Addition and subtraction
163 // <group>
165 MVuvw &operator+=(const MVuvw &right);
166 MVuvw operator+(const MVuvw &right) const;
167 MVuvw &operator-=(const MVuvw &right);
168 MVuvw operator-(const MVuvw &right) const;
169 // </group>
170
171 // # General Member Functions
172
173 // Tell me your type
174 // <group>
175 static void assure(const MeasValue &in);
176 // </group>
177
178 // Normalise direction aspects by adjusting the length to 1
179 // <group>
180 virtual void adjust();
181 virtual void adjust(Double &res);
182 virtual void readjust(Double res);
183 // </group>
184 // Get radius(i.e. length of vector, in m) of uvw
185 virtual Double radius();
186 // Generate a 3-vector of coordinates (length(m), angles(rad))
188 // Generate a 3-vector of x,y,z in m
189 const Vector<Double> &getValue() const;
190 // Generate angle 2-vector (in rad)
192 // and with specified units
194 // Generate the length
196 // and generate it with the specified units
197 Quantity getLength(const Unit &unit) const;
198 // Get the uvw angle between the directions. I.e. the angle between
199 // the direction from one to the pole, and from one to the other.
200 // <group>
201 Double uvwAngle(const MVuvw &other) const;
202 Quantity uvwAngle(const MVuvw &other, const Unit &unit) const;
203 // </group>
204 // Get the angular separation between two directions.
205 // <group>
206 Double separation(const MVuvw &other) const;
207 Quantity separation(const MVuvw &other, const Unit &unit) const;
208 // </group>
209 // Produce the cross product
210 MVuvw crossProduct(const MVuvw &other) const;
211
212 // Print data
213 virtual void print(ostream &os) const;
214 // Clone
215 virtual MeasValue *clone() const;
216
217 // Get the value in internal units
218 virtual Vector<Double> getVector() const;
219 // Set the value from internal units (set 0 for empty vector)
220 virtual void putVector(const Vector<Double> &in);
221 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
222 // records. The getXRecordValue() gets additional information for records.
223 // Note that the Vectors could be empty.
224 // <group>
228 // </group>
229 // Set the internal value if correct values and dimensions
230 virtual Bool putValue(const Vector<Quantum<Double>> &in);
231};
232
233// # Global functions
234// Rotate a uvw vector with rotation matrix and other multiplications
235// <group>
236MVuvw operator*(const RotMatrix &left, const MVuvw &right);
237MVuvw operator*(const MVuvw &left, const RotMatrix &right);
238MVuvw operator*(Double left, const MVuvw &right);
239MVuvw operator*(const MVuvw &left, Double right);
240Double operator*(const Vector<Double> &left, const MVuvw &right);
241Double operator*(const MVuvw &left, const Vector<Double> &right);
242Double operator*(const MVPosition &left, const MVuvw &right);
243Double operator*(const MVuvw &left, const MVPosition &right);
244// </group>
245
246} // namespace casacore
247
248#endif
MVPosition()
Default constructor generates a (0,0,0) position.
const Vector< Double > & getValue() const
Generate a 3-vector of x,y,z in m.
MVuvw(const MVPosition &other)
Creates from an MVPosition.
Quantity getLength(const Unit &unit) const
and generate it with the specified units
virtual Vector< Quantum< Double > > getTMRecordValue() const
Definition MVuvw.h:227
Quantity getLength() const
Generate the length.
virtual MeasValue * clone() const
Clone.
MVuvw operator-(const MVuvw &right) const
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector<Quantity>.
virtual void print(ostream &os) const
Print data.
virtual void adjust()
Normalise direction aspects by adjusting the length to 1.
Quantity separation(const MVuvw &other, const Unit &unit) const
Bool near(const MVuvw &other, Quantity tol) const
MVuvw crossProduct(const MVuvw &other) const
Produce the cross product.
Bool nearAbs(const MVuvw &other, Double tol=1e-13) const
static void assure(const MeasValue &in)
Tell me your type.
Double separation(const MVuvw &other) const
Get the angular separation between two directions.
MVuvw(const Quantity &l)
MVuvw operator+(const MVuvw &right) const
MVuvw(const Vector< Double > &other)
Create from specified length and/or angles and/or uvw.
MVuvw(const Vector< Quantity > &other)
Bool operator!=(const MVuvw &other) const
Bool operator==(const MVuvw &other) const
Equality comparisons.
virtual Vector< Double > getVector() const
Get the value in internal units.
Quantum< Vector< Double > > getAngle(const Unit &unit) const
and with specified units
Quantity uvwAngle(const MVuvw &other, const Unit &unit) const
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
Vector< Double > get() const
Generate a 3-vector of coordinates (length(m), angles(rad)).
virtual Double radius()
Get radius(i.e.
Quantum< Vector< Double > > getAngle() const
Generate angle 2-vector (in rad).
MVuvw(const Quantity &l, const Quantum< Vector< Double > > &angle)
MVuvw(const Quantity &l, const Quantity &angle0, const Quantity &angle1)
Creates the uvw from specified angles and length.
MVuvw(const Quantum< Vector< Double > > &angle)
If not enough angles: pole assumed (if none), or elevation =0 (if 1).
MVuvw & operator-=(const MVuvw &right)
MVuvw(const Quantity &l, Double angle0, Double angle1)
Creates the uvw from specified (azimuth,elevation) angles and length.
MVuvw(const MVBaseline &pos, const MVDirection &dr, Bool ew=False)
uvw from a baseline and a reference direction (in same frame)
MVuvw & operator+=(const MVuvw &right)
MVuvw(Double in0)
Creates a vector with specified length towards pole.
virtual void readjust(Double res)
Re-adjust using factor given.
Double operator*(const MVuvw &other) const
Multiplication defined as in-product.
MVuvw(Double in0, Double in1, Double in2)
Creates a specified vector.
MVuvw operator-() const
Addition and subtraction.
virtual Vector< Quantum< Double > > getXRecordValue() const
virtual void adjust(Double &res)
Adjustment with returned factor.
Bool near(const MVuvw &other, Double tol=1e-13) const
MVuvw()
Default constructor generates a (0,0,0) uvw.
Double uvwAngle(const MVuvw &other) const
Get the uvw angle between the directions.
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector).
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
T & operator*()
Provide access to the field's value.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
Quantum< Double > Quantity
Definition Quantum.h:40
double Double
Definition aipstype.h:53