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