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
111public:
112
113 //# Friends
114
115 //# Constructors
116 // Default constructor generates a (0,0,0) uvw
118 // Creates from an MVPosition
119 MVuvw(const MVPosition &other);
120 // Creates a specified vector
121 MVuvw(Double in0, Double in1, Double in2);
122 // Creates a vector with specified length towards pole
123 // <group>
124 explicit MVuvw(Double in0);
125 MVuvw(const Quantity &l);
126 // </group>
127 // Creates the uvw from specified (azimuth,elevation) angles and length
128 MVuvw(const Quantity &l, Double angle0, Double angle1);
129 // Creates the uvw from specified angles and length. or uvws
130 // <thrown>
131 // <li> AipsError if quantities not in angle format
132 // </thrown>
133 // <group>
134 MVuvw(const Quantity &l, const Quantity &angle0,
135 const Quantity &angle1);
136 // If not enough angles: pole assumed (if none), or elevation =0 (if 1)
137 MVuvw(const Quantum<Vector<Double> > &angle);
138 MVuvw(const Quantity &l, const Quantum<Vector<Double> > &angle);
139 // </group>
140 // Create from specified length and/or angles and/or uvw
141 // <group>
142 MVuvw(const Vector<Double> &other);
143 MVuvw(const Vector<Quantity> &other);
144 // </group>
145 // uvw from a baseline and a reference direction (in same frame)
146 // <group>
147 MVuvw(const MVBaseline &pos, const MVDirection &dr, Bool ew=False);
148 // </group>
149
150 //# Operators
151 // Multiplication defined as in-product
152 // <group>
153 Double operator*(const MVuvw &other) const;
154 // </group>
155
156 // Equality comparisons
157 // <group>
158 Bool operator== (const MVuvw &other) const;
159 Bool operator!= (const MVuvw &other) const;
160 Bool near(const MVuvw &other, Double tol=1e-13) const;
161 Bool near(const MVuvw &other, Quantity tol) const;
162 Bool nearAbs(const MVuvw &other, Double tol=1e-13) const;
163 // </group>
164
165 // Addition and subtraction
166 // <group>
168 MVuvw &operator+=(const MVuvw &right);
169 MVuvw operator+(const MVuvw &right) const;
170 MVuvw &operator-=(const MVuvw &right);
171 MVuvw operator-(const MVuvw &right) const;
172 // </group>
173
174 //# General Member Functions
175
176 // Tell me your type
177 // <group>
178 static void assure(const MeasValue &in);
179 // </group>
180
181 // Normalise direction aspects by adjusting the length to 1
182 // <group>
183 virtual void adjust();
184 virtual void adjust(Double &res);
185 virtual void readjust(Double res);
186 // </group>
187 // Get radius(i.e. length of vector, in m) of uvw
188 virtual Double radius();
189 // Generate a 3-vector of coordinates (length(m), angles(rad))
191 // Generate a 3-vector of x,y,z in m
192 const Vector<Double> &getValue() const;
193 // Generate angle 2-vector (in rad)
195 // and with specified units
197 // Generate the length
199 // and generate it with the specified units
200 Quantity getLength(const Unit &unit) const;
201 // Get the uvw angle between the directions. I.e. the angle between
202 // the direction from one to the pole, and from one to the other.
203 // <group>
204 Double uvwAngle(const MVuvw &other) const;
205 Quantity uvwAngle(const MVuvw &other,
206 const Unit &unit) const;
207 // </group>
208 // Get the angular separation between two directions.
209 // <group>
210 Double separation(const MVuvw &other) const;
211 Quantity separation(const MVuvw &other,
212 const Unit &unit) const;
213 // </group>
214 // Produce the cross product
215 MVuvw crossProduct(const MVuvw &other) const;
216
217 // Print data
218 virtual void print(ostream &os) const;
219 // Clone
220 virtual MeasValue *clone() const;
221
222 // Get the value in internal units
223 virtual Vector<Double> getVector() const;
224 // Set the value from internal units (set 0 for empty vector)
225 virtual void putVector(const Vector<Double> &in);
226 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
227 // records. The getXRecordValue() gets additional information for records.
228 // Note that the Vectors could be empty.
229 // <group>
233 return getXRecordValue(); } ;
234 // </group>
235 // Set the internal value if correct values and dimensions
236 virtual Bool putValue(const Vector<Quantum<Double> > &in);
237
238};
239
240//# Global functions
241// Rotate a uvw vector with rotation matrix and other multiplications
242// <group>
243MVuvw operator*(const RotMatrix &left, const MVuvw &right);
244MVuvw operator*(const MVuvw &left, const RotMatrix &right);
245MVuvw operator*(Double left, const MVuvw &right);
246MVuvw operator*(const MVuvw &left, Double right);
247Double operator*(const Vector<Double> &left, const MVuvw &right);
248Double operator*(const MVuvw &left, const Vector<Double> &right);
249Double operator*(const MVPosition &left, const MVuvw &right);
250Double operator*(const MVuvw &left, const MVPosition &right);
251// </group>
252
253
254} //# NAMESPACE CASACORE - END
255
256#endif
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:232
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)
this file contains all the compiler specific defines
Definition mainpage.dox:28
const Bool False
Definition aipstype.h:42
MVBaseline operator*(const RotMatrix &left, const MVBaseline &right)
Rotate a Baseline vector with rotation matrix and other multiplications.
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
double Double
Definition aipstype.h:53