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 public:
108 // # Friends
109
110 // # Constructors
111 // Default constructor generates a (0,0,0) Baseline
113 // Creates from an MVPosition
114 MVBaseline(const MVPosition &other);
115 // Creates a specified vector
117 // Creates a vector with specified length towards pole
118 // <group>
119 explicit MVBaseline(Double in0);
121 // </group>
122 // Creates the Baseline from specified (azimuth,elevation) angles and length
123 MVBaseline(const Quantity &l, Double angle0, Double angle1);
124 // Creates the Baseline from specified angles and length. or Baselines
125 // <thrown>
126 // <li> AipsError if quantities not in angle format
127 // </thrown>
128 // <group>
129 MVBaseline(const Quantity &l, const Quantity &angle0, const Quantity &angle1);
130 // If not enough angles: pole assumed (if none), or elevation =0 (if 1)
132 MVBaseline(const Quantity &l, const Quantum<Vector<Double>> &angle);
133 // </group>
134 // Create from specified length and/or angles and/or Baseline
135 // <group>
138 // </group>
139 // Baseline as difference between positions (first - second (default(0,0,0))
140 // <group>
141 MVBaseline(const MVPosition &pos, const MVPosition &base);
142 // </group>
143
144 // # Operators
145 // Multiplication defined as in-product
146 // <group>
147 Double operator*(const MVBaseline &other) const;
148 // </group>
149
150 // Equality comparisons
151 // <group>
152 Bool operator==(const MVBaseline &other) const;
153 Bool operator!=(const MVBaseline &other) const;
154 Bool near(const MVBaseline &other, Double tol = 1e-13) const;
155 Bool near(const MVBaseline &other, Quantity tol) const;
156 Bool nearAbs(const MVBaseline &other, Double tol = 1e-13) const;
157 // </group>
158
159 // Addition and subtraction
160 // <group>
163 MVBaseline operator+(const MVBaseline &right) const;
165 MVBaseline operator-(const MVBaseline &right) const;
166 // </group>
167
168 // # General Member Functions
169
170 // Tell me your type
171 // <group>
172 static void assure(const MeasValue &in);
173 // </group>
174
175 // Normalise direction aspects by adjusting the length to 1
176 // <group>
177 virtual void adjust();
178 virtual void adjust(Double &res);
179 virtual void readjust(Double res);
180 // </group>
181 // Get radius of Baseline
182 virtual Double radius();
183 // Generate a 3-vector of coordinates (length(m), angles(rad))
185 // Generate a 3-vector of x,y,z in m
186 const Vector<Double> &getValue() const;
187 // Generate angle 2-vector (in rad)
189 // and with specified units
191 // Generate the length
193 // and generate it with the specified units
194 Quantity getLength(const Unit &unit) const;
195 // Get the Baseline angle between the directions. I.e. the angle between
196 // the direction from one to the pole, and from one to the other.
197 // <group>
198 Double BaselineAngle(const MVBaseline &other) const;
199 Quantity BaselineAngle(const MVBaseline &other, const Unit &unit) const;
200 // </group>
201 // Get the angular separation between two directions.
202 // <group>
203 Double separation(const MVBaseline &other) const;
204 Quantity separation(const MVBaseline &other, const Unit &unit) const;
205 // </group>
206 // Produce the cross product
207 MVBaseline crossProduct(const MVBaseline &other) const;
208
209 // Print data
210 virtual void print(ostream &os) const;
211 // Clone
212 virtual MeasValue *clone() const;
213
214 // Get the value in internal units
215 virtual Vector<Double> getVector() const;
216 // Set the value from internal units (set 0 for empty vector)
217 virtual void putVector(const Vector<Double> &in);
218 // Get the internal value as a <src>Vector<Quantity></src>. Usable in
219 // records. The getXRecordValue() gets additional information for records.
220 // Note that the Vectors could be empty.
221 // <group>
225 // </group>
226 // Set the internal value if correct values and dimensions
227 virtual Bool putValue(const Vector<Quantum<Double>> &in);
228};
229
230// # Global functions
231// Rotate a Baseline vector with rotation matrix and other multiplications
232// <group>
233MVBaseline operator*(const RotMatrix &left, const MVBaseline &right);
234MVBaseline operator*(const MVBaseline &left, const RotMatrix &right);
237Double operator*(const Vector<Double> &left, const MVBaseline &right);
238Double operator*(const MVBaseline &left, const Vector<Double> &right);
239Double operator*(const MVPosition &left, const MVBaseline &right);
240Double operator*(const MVBaseline &left, const MVPosition &right);
241// </group>
242
243} // namespace casacore
244
245#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:224
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.
MVPosition()
Default constructor generates a (0,0,0) position.
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
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