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