casa
$Rev:20696$
|
00001 //# MVBaseline.h: A 3D vector on Earth 00002 //# Copyright (C) 1998,2000 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: MVBaseline.h 20551 2009-03-25 00:11:33Z Malte.Marquarding $ 00027 00028 #ifndef CASA_MVBASELINE_H 00029 #define CASA_MVBASELINE_H 00030 00031 //# Includes 00032 #include <casa/aips.h> 00033 #include <casa/Quanta/MVPosition.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 //# Forward Declarations 00038 00039 // <summary> A 3D vector on Earth </summary> 00040 00041 // <use visibility=export> 00042 00043 // <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tMBaseline" demos=""> 00044 // </reviewed> 00045 00046 // <prerequisite> 00047 // <li> <linkto class=MeasValue>MeasValue</linkto> 00048 // </prerequisite> 00049 // 00050 // <etymology> 00051 // From Measure, Value and Baseline 00052 // </etymology> 00053 // 00054 // <synopsis> 00055 // A MVBaseline is a 3-vector of Baselines in a rectangular frame with 00056 // internal units of m.<br> 00057 // It can be constructed with: 00058 // <ul> 00059 // <li> MVBaseline() creates point at origin (0,0,0) 00060 // <li> MVBaseline(MVBaseline) creates a copy 00061 // <li> MVBaseline(Double, Double, Double) creates (x,y,z) with 00062 // specified values (assuming meters) 00063 // <li> MVBaseline(Quantity length,Double, Double) creates a MVBaseline assuming 00064 // that the two values are (in radians) angle along 'equator' 00065 // and towards 'pole'. 00066 // <li> MVBaseline(Quantity length, Quantity, Quantity) creates a MVBaseline 00067 // assuming angles as in previous, or Baselines 00068 // <li> <src>MVBaseline(Quantity, Quantum<Vector<Double> >)</src> creates a 00069 // MVBaseline from angle vector, using first two angles, and 00070 // assuming second as zero if not present. 00071 // <li> <src>MVBaseline(Quantum<Vector<Double> ></src> creates from 00072 // angles or Baselines, depending on the units in the 00073 // quantum vector. In the angle case, 00074 // the data derived can be scaled with the readjust() function. If 00075 // the unit of the quantum vector is length, Baseline is 00076 // assumed. 00077 // <li> <src>MVBaseline(Vector<Double></src> creates from angles (less than 00078 // or equal to two elements) or x,y,z (3 elements). 00079 // <li> <src>MVBaseline(Vector<Quantity></src> creates from length+angles, 00080 // angles, or x,y,z, depending on units. 00081 // <li> <src>MVBaseline(MVPosition, MVPosition)</src> creates a baseline 00082 // pointing from second to first MVPosition 00083 // <li> <src>MVBaseline(MVPosition)</src> creates a baseline as defined by the 00084 // position given (e.g. as derived from an offset MPosition) 00085 // </ul> 00086 // A void adjust(Double) function normalises the vector to a length of 1; 00087 // a get() returns as a 00088 // Double 3-vector the length and angles of the Baseline vector; 00089 // a getAngle() returns a Quantum 2-vector, (uInt) returns the indicated 00090 // element, and getValue returns the vector.<br> 00091 // Baselines can be added and subtracted.<br> 00092 // The multiplication of two Baselines produces the in-product.<br> 00093 // </synopsis> 00094 // 00095 // <example> 00096 // See <linkto class=MBaseline>MBaseline</linkto> class. 00097 // </example> 00098 // 00099 // <motivation> 00100 // To do coordinate transformations 00101 // </motivation> 00102 // 00103 // <todo asof="1998/04/20"> 00104 // <li> Nothing I know of 00105 // </todo> 00106 00107 class MVBaseline : public MVPosition { 00108 00109 public: 00110 00111 //# Friends 00112 00113 //# Constructors 00114 // Default constructor generates a (0,0,0) Baseline 00115 MVBaseline(); 00116 // Copy constructor 00117 MVBaseline(const MVPosition &other); 00118 // Creates a specified vector 00119 MVBaseline(Double in0, Double in1, Double in2); 00120 // Creates a vector with specified length towards pole 00121 // <group> 00122 explicit MVBaseline(Double in0); 00123 MVBaseline(const Quantity &l); 00124 // </group> 00125 // Creates the Baseline from specified (azimuth,elevation) angles and length 00126 MVBaseline(const Quantity &l, Double angle0, Double angle1); 00127 // Creates the Baseline from specified angles and length. or Baselines 00128 // <thrown> 00129 // <li> AipsError if quantities not in angle format 00130 // </thrown> 00131 // <group> 00132 MVBaseline(const Quantity &l, const Quantity &angle0, 00133 const Quantity &angle1); 00134 // If not enough angles: pole assumed (if none), or elevation =0 (if 1) 00135 MVBaseline(const Quantum<Vector<Double> > &angle); 00136 MVBaseline(const Quantity &l, const Quantum<Vector<Double> > &angle); 00137 // </group> 00138 // Create from specified length and/or angles and/or Baseline 00139 // <group> 00140 MVBaseline(const Vector<Double> &other); 00141 MVBaseline(const Vector<Quantity> &other); 00142 // </group> 00143 // Baseline as difference between positions (first - second (default(0,0,0)) 00144 // <group> 00145 MVBaseline(const MVPosition &pos, const MVPosition &base); 00146 // </group> 00147 // Copy assignment 00148 MVBaseline &operator=(const MVBaseline &other); 00149 00150 // Destructor 00151 ~MVBaseline(); 00152 00153 //# Operators 00154 // Multiplication defined as in-product 00155 // <group> 00156 Double operator*(const MVBaseline &other) const; 00157 // </group> 00158 00159 // Equality comparisons 00160 // <group> 00161 Bool operator== (const MVBaseline &other) const; 00162 Bool operator!= (const MVBaseline &other) const; 00163 Bool near(const MVBaseline &other, Double tol=1e-13) const; 00164 Bool near(const MVBaseline &other, Quantity tol) const; 00165 Bool nearAbs(const MVBaseline &other, Double tol=1e-13) const; 00166 // </group> 00167 00168 // Addition and subtraction 00169 // <group> 00170 MVBaseline operator-() const; 00171 MVBaseline &operator+=(const MVBaseline &right); 00172 MVBaseline operator+(const MVBaseline &right) const; 00173 MVBaseline &operator-=(const MVBaseline &right); 00174 MVBaseline operator-(const MVBaseline &right) const; 00175 // </group> 00176 00177 //# General Member Functions 00178 00179 // Tell me your type 00180 // <group> 00181 virtual uInt type() const; 00182 static void assure(const MeasValue &in); 00183 // </group> 00184 00185 // Normalise direction aspects by adjusting the length to 1 00186 // <group> 00187 virtual void adjust(); 00188 virtual void adjust(Double &res); 00189 virtual void readjust(Double res); 00190 // </group> 00191 // Get radius of Baseline 00192 virtual Double radius(); 00193 // Generate a 3-vector of coordinates (length(m), angles(rad)) 00194 Vector<Double> get() const; 00195 // Generate a 3-vector of x,y,z in m 00196 const Vector<Double> &getValue() const; 00197 // Generate angle 2-vector (in rad) 00198 Quantum<Vector<Double> > getAngle() const; 00199 // and with specified units 00200 Quantum<Vector<Double> > getAngle(const Unit &unit) const; 00201 // Generate the length 00202 Quantity getLength() const; 00203 // and generate it with the specified units 00204 Quantity getLength(const Unit &unit) const; 00205 // Get the Baseline angle between the directions. I.e. the angle between 00206 // the direction from one to the pole, and from one to the other. 00207 // <group> 00208 Double BaselineAngle(const MVBaseline &other) const; 00209 Quantity BaselineAngle(const MVBaseline &other, 00210 const Unit &unit) const; 00211 // </group> 00212 // Get the angular separation between two directions. 00213 // <group> 00214 Double separation(const MVBaseline &other) const; 00215 Quantity separation(const MVBaseline &other, 00216 const Unit &unit) const; 00217 // </group> 00218 // Produce the cross product 00219 MVBaseline crossProduct(const MVBaseline &other) const; 00220 00221 // Print data 00222 virtual void print(ostream &os) const; 00223 // Clone 00224 virtual MeasValue *clone() const; 00225 00226 // Get the value in internal units 00227 virtual Vector<Double> getVector() const; 00228 // Set the value from internal units (set 0 for empty vector) 00229 virtual void putVector(const Vector<Double> &in); 00230 // Get the internal value as a <src>Vector<Quantity></src>. Usable in 00231 // records. The getXRecordValue() gets additional information for records. 00232 // Note that the Vectors could be empty. 00233 // <group> 00234 virtual Vector<Quantum<Double> > getRecordValue() const; 00235 virtual Vector<Quantum<Double> > getXRecordValue() const; 00236 virtual Vector<Quantum<Double> > getTMRecordValue() const { 00237 return getXRecordValue(); } ; 00238 // </group> 00239 // Set the internal value if correct values and dimensions 00240 virtual Bool putValue(const Vector<Quantum<Double> > &in); 00241 00242 }; 00243 00244 //# Global functions 00245 // Rotate a Baseline vector with rotation matrix and other multiplications 00246 // <group> 00247 MVBaseline operator*(const RotMatrix &left, const MVBaseline &right); 00248 MVBaseline operator*(const MVBaseline &left, const RotMatrix &right); 00249 MVBaseline operator*(Double left, const MVBaseline &right); 00250 MVBaseline operator*(const MVBaseline &left, Double right); 00251 Double operator*(const Vector<Double> &left, const MVBaseline &right); 00252 Double operator*(const MVBaseline &left, const Vector<Double> &right); 00253 Double operator*(const MVPosition &left, const MVBaseline &right); 00254 Double operator*(const MVBaseline &left, const MVPosition &right); 00255 // </group> 00256 00257 00258 } //# NAMESPACE CASA - END 00259 00260 #endif