casacore
Loading...
Searching...
No Matches
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: 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_MVBASELINE_H
27#define CASA_MVBASELINE_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
36
37// <summary> A 3D vector on Earth </summary>
38
39// <use visibility=export>
40
41// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMBaseline" demos="">
42// </reviewed>
43
44// <prerequisite>
45// <li> <linkto class=MeasValue>MeasValue</linkto>
46// </prerequisite>
47//
48// <etymology>
49// From Measure, Value and Baseline
50// </etymology>
51//
52// <synopsis>
53// A MVBaseline is a 3-vector of Baselines in a rectangular frame with
54// internal units of m.<br>
55// It can be constructed with:
56// <ul>
57// <li> MVBaseline() creates point at origin (0,0,0)
58// <li> MVBaseline(MVBaseline) creates a copy
59// <li> MVBaseline(MVPosition) creates (x,y,z) from the given position
60// <li> MVBaseline(Double, Double, Double) creates (x,y,z) with
61// specified values (assuming meters)
62// <li> MVBaseline(Quantity length,Double, Double) creates a MVBaseline assuming
63// that the two values are (in radians) angle along 'equator'
64// and towards 'pole'.
65// <li> MVBaseline(Quantity length, Quantity, Quantity) creates a MVBaseline
66// assuming angles as in previous, or Baselines
67// <li> <src>MVBaseline(Quantity, Quantum<Vector<Double> >)</src> creates a
68// MVBaseline from angle vector, using first two angles, and
69// assuming second as zero if not present.
70// <li> <src>MVBaseline(Quantum<Vector<Double> ></src> creates from
71// angles or Baselines, depending on the units in the
72// quantum vector. In the angle case,
73// the data derived can be scaled with the readjust() function. If
74// the unit of the quantum vector is length, Baseline is
75// assumed.
76// <li> <src>MVBaseline(Vector<Double></src> creates from angles (less than
77// or equal to two elements) or x,y,z (3 elements).
78// <li> <src>MVBaseline(Vector<Quantity></src> creates from length+angles,
79// angles, or x,y,z, depending on units.
80// <li> <src>MVBaseline(MVPosition, MVPosition)</src> creates a baseline
81// pointing from second to first MVPosition
82// <li> <src>MVBaseline(MVPosition)</src> creates a baseline as defined by the
83// position given (e.g. as derived from an offset MPosition)
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 Baseline vector;
88// a getAngle() returns a Quantum 2-vector, (uInt) returns the indicated
89// element, and getValue returns the vector.<br>
90// Baselines can be added and subtracted.<br>
91// The multiplication of two Baselines produces the in-product.<br>
92// </synopsis>
93//
94// <example>
95// See <linkto class=MBaseline>MBaseline</linkto> class.
96// </example>
97//
98// <motivation>
99// To do coordinate transformations
100// </motivation>
101//
102// <todo asof="1998/04/20">
103// <li> Nothing I know of
104// </todo>
105
106class MVBaseline : public MVPosition {
107
108public:
109
110 //# Friends
111
112 //# Constructors
113 // Default constructor generates a (0,0,0) Baseline
115 // Creates from an MVPosition
116 MVBaseline(const MVPosition &other);
117 // Creates a specified vector
119 // Creates a vector with specified length towards pole
120 // <group>
121 explicit MVBaseline(Double in0);
123 // </group>
124 // Creates the Baseline from specified (azimuth,elevation) angles and length
125 MVBaseline(const Quantity &l, Double angle0, Double angle1);
126 // Creates the Baseline from specified angles and length. or Baselines
127 // <thrown>
128 // <li> AipsError if quantities not in angle format
129 // </thrown>
130 // <group>
131 MVBaseline(const Quantity &l, const Quantity &angle0,
132 const Quantity &angle1);
133 // If not enough angles: pole assumed (if none), or elevation =0 (if 1)
135 MVBaseline(const Quantity &l, const Quantum<Vector<Double> > &angle);
136 // </group>
137 // Create from specified length and/or angles and/or Baseline
138 // <group>
141 // </group>
142 // Baseline as difference between positions (first - second (default(0,0,0))
143 // <group>
144 MVBaseline(const MVPosition &pos, const MVPosition &base);
145 // </group>
146
147 //# Operators
148 // Multiplication defined as in-product
149 // <group>
150 Double operator*(const MVBaseline &other) const;
151 // </group>
152
153 // Equality comparisons
154 // <group>
155 Bool operator== (const MVBaseline &other) const;
156 Bool operator!= (const MVBaseline &other) const;
157 Bool near(const MVBaseline &other, Double tol=1e-13) const;
158 Bool near(const MVBaseline &other, Quantity tol) const;
159 Bool nearAbs(const MVBaseline &other, Double tol=1e-13) const;
160 // </group>
161
162 // Addition and subtraction
163 // <group>
166 MVBaseline operator+(const MVBaseline &right) const;
168 MVBaseline operator-(const MVBaseline &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 of Baseline
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 Baseline 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 BaselineAngle(const MVBaseline &other) const;
203 const Unit &unit) const;
204 // </group>
205 // Get the angular separation between two directions.
206 // <group>
207 Double separation(const MVBaseline &other) const;
209 const Unit &unit) const;
210 // </group>
211 // Produce the cross product
212 MVBaseline crossProduct(const MVBaseline &other) const;
213
214 // Print data
215 virtual void print(ostream &os) const;
216 // Clone
217 virtual MeasValue *clone() const;
218
219 // Get the value in internal units
220 virtual Vector<Double> getVector() const;
221 // Set the value from internal units (set 0 for empty vector)
222 virtual void putVector(const Vector<Double> &in);
223 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
224 // records. The getXRecordValue() gets additional information for records.
225 // Note that the Vectors could be empty.
226 // <group>
230 return getXRecordValue(); } ;
231 // </group>
232 // Set the internal value if correct values and dimensions
233 virtual Bool putValue(const Vector<Quantum<Double> > &in);
234
235};
236
237//# Global functions
238// Rotate a Baseline vector with rotation matrix and other multiplications
239// <group>
240MVBaseline operator*(const RotMatrix &left, const MVBaseline &right);
241MVBaseline operator*(const MVBaseline &left, const RotMatrix &right);
244Double operator*(const Vector<Double> &left, const MVBaseline &right);
245Double operator*(const MVBaseline &left, const Vector<Double> &right);
246Double operator*(const MVPosition &left, const MVBaseline &right);
247Double operator*(const MVBaseline &left, const MVPosition &right);
248// </group>
249
250
251} //# NAMESPACE CASACORE - END
252
253#endif
virtual void adjust(Double &res)
Adjustment with returned factor.
MVBaseline operator+(const MVBaseline &right) const
Double separation(const MVBaseline &other) const
Get the angular separation between two directions.
virtual void putVector(const Vector< Double > &in)
Set the value from internal units (set 0 for empty vector)
Bool near(const MVBaseline &other, Quantity tol) const
static void assure(const MeasValue &in)
Tell me your type.
virtual Bool putValue(const Vector< Quantum< Double > > &in)
Set the internal value if correct values and dimensions.
Bool operator!=(const MVBaseline &other) const
Quantity getLength() const
Generate the length.
virtual Vector< Quantum< Double > > getRecordValue() const
Get the internal value as a Vector<Quantity>.
Bool near(const MVBaseline &other, Double tol=1e-13) const
MVBaseline(const Vector< Double > &other)
Create from specified length and/or angles and/or Baseline.
virtual Vector< Quantum< Double > > getXRecordValue() const
virtual MeasValue * clone() const
Clone.
MVBaseline(const Vector< Quantity > &other)
Quantity getLength(const Unit &unit) const
and generate it with the specified units
MVBaseline(Double in0, Double in1, Double in2)
Creates a specified vector.
Quantum< Vector< Double > > getAngle() const
Generate angle 2-vector (in rad)
virtual Vector< Double > getVector() const
Get the value in internal units.
virtual Double radius()
Get radius of Baseline.
MVBaseline crossProduct(const MVBaseline &other) const
Produce the cross product.
Bool operator==(const MVBaseline &other) const
Equality comparisons.
MVBaseline operator-() const
Addition and subtraction.
MVBaseline(const Quantity &l, const Quantity &angle0, const Quantity &angle1)
Creates the Baseline from specified angles and length.
MVBaseline()
Default constructor generates a (0,0,0) Baseline.
MVBaseline(const Quantum< Vector< Double > > &angle)
If not enough angles: pole assumed (if none), or elevation =0 (if 1)
MVBaseline(const MVPosition &pos, const MVPosition &base)
Baseline as difference between positions (first - second (default(0,0,0))
MVBaseline(const Quantity &l)
MVBaseline(Double in0)
Creates a vector with specified length towards pole.
virtual void print(ostream &os) const
Print data.
virtual Vector< Quantum< Double > > getTMRecordValue() const
Definition MVBaseline.h:229
Quantity BaselineAngle(const MVBaseline &other, const Unit &unit) const
Quantum< Vector< Double > > getAngle(const Unit &unit) const
and with specified units
MVBaseline(const MVPosition &other)
Creates from an MVPosition.
const Vector< Double > & getValue() const
Generate a 3-vector of x,y,z in m.
Double operator*(const MVBaseline &other) const
Multiplication defined as in-product.
Vector< Double > get() const
Generate a 3-vector of coordinates (length(m), angles(rad))
Quantity separation(const MVBaseline &other, const Unit &unit) const
Bool nearAbs(const MVBaseline &other, Double tol=1e-13) const
virtual void readjust(Double res)
Re-adjust using factor given.
MVBaseline operator-(const MVBaseline &right) const
virtual void adjust()
Normalise direction aspects by adjusting the length to 1.
MVBaseline(const Quantity &l, Double angle0, Double angle1)
Creates the Baseline from specified (azimuth,elevation) angles and length.
MVBaseline & operator-=(const MVBaseline &right)
MVBaseline(const Quantity &l, const Quantum< Vector< Double > > &angle)
MVBaseline & operator+=(const MVBaseline &right)
Double BaselineAngle(const MVBaseline &other) const
Get the Baseline angle between the directions.
this file contains all the compiler specific defines
Definition mainpage.dox:28
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