MVPosition.h
Classes
- MVPosition -- A 3D vector in space (full description)
Interface
- Public Members
- MVPosition()
- MVPosition(const MVPosition &other)
- MVPosition(Double in0, Double in1, Double in2)
- explicit MVPosition(Double in0)
- MVPosition(const Quantity &l)
- MVPosition(const Quantity &l, Double angle0, Double angle1)
- MVPosition(const Quantity &l, const Quantity &angle0, const Quantity &angle1)
- MVPosition(const Quantum<Vector<Double> > &angle)
- MVPosition(const Quantity &l, const Quantum<Quantum<Double> > &angle)
- explicit MVPosition(const Vector<Double> &other)
- MVPosition(const Vector<Quantity> &other)
- MVPosition &operator=(const MVPosition &other)
- ~MVPosition()
- Double operator*(const MVPosition &other) const
- Bool operator== (const MVPosition &other) const
- Bool operator!= (const MVPosition &other) const
- Bool near(const MVPosition &other, Double tol=1e-13) const
- Bool near(const MVPosition &other, Quantity tol) const
- Bool nearAbs(const MVPosition &other, Double tol=1e-13) const
- MVPosition operator-() const
- MVPosition &operator+=(const MVPosition &right)
- MVPosition operator+(const MVPosition &right) const
- MVPosition &operator-=(const MVPosition &right)
- MVPosition operator-(const MVPosition &right) const
- MVPosition &operator*=(const RotMatrix &right)
- MVPosition &operator*=(Double right)
- Double &operator()(uInt which)
- const Double &operator()(uInt which) const
- virtual uInt type() const
- static void assure(const MeasValue &in)
- virtual void adjust()
- virtual void adjust(Double &res)
- virtual void readjust(Double res)
- virtual Double radius()
- Vector<Double> get() const
- const Vector<Double> &getValue() const
- Quantum<Vector<Double> > getAngle() const
- Quantum<Vector<Double> > getAngle(const Unit &unit) const
- Double getLong() const
- Quantity getLong(const Unit &unit) const
- Double getLat() const
- Quantity getLat(const Unit &unit) const
- Quantity getLength() const
- Quantity getLength(const Unit &unit) const
- Double positionAngle(const MVPosition &other) const
- Quantity positionAngle(const MVPosition &other, const Unit &unit) const
- Double separation(const MVPosition &other) const
- Quantity separation(const MVPosition &other, const Unit &unit) const
- MVPosition crossProduct(const MVPosition &other) const
- virtual void print(ostream &os) const
- virtual MeasValue *clone() const
- virtual Vector<Double> getVector() const
- virtual void putVector(const Vector<Double> &in)
- virtual Vector<Quantum<Double> > getRecordValue() const
- virtual Vector<Quantum<Double> > getXRecordValue() const
- virtual Vector<Quantum<Double> > getTMRecordValue() const
- virtual Bool putValue(const Vector<Quantum<Double> > &in)
- Protected Members
- Double getLat(Double ln) const
Review Status
- Reviewed By:
- tcornwel
- Date Reviewed:
- 1996/02/22
- Programs:
- Tests:
Prerequisite
Etymology
From Measure, Value and Position
Synopsis
A MVPosition is a 3-vector of positions in a rectangular frame with
internal units of m.
It can be constructed with:
- MVPosition() creates point at origin (0,0,0)
- MVPosition(MVPosition) creates a copy
- MVPosition(Double, Double, Double) creates (x,y,z) with
specified values
- MVPosition(Quantity length,Double, Double) creates a MVPosition assuming
that the two values are (in radians) angle along 'equator'
and towards 'pole'. A length of zero will be made 1um.
- MVPosition(Quantity length, Quantity, Quantity) creates a MVPosition
assuming angles as in previous, or positions
- MVPosition(Quantity, Quantum<Vector<Double> >) creates a
MVPosition from angle vector, using first two angles, and
assuming second as zero if not present, and pole if length 0.
- MVPosition(Quantum<Vector<Double> > creates from
angles or positions, depending on the units in the
quantum vector. In the angle case,
the data derived can be scaled with the readjust() function. If
the unit of the quantum vector is length, position is
assumed.
- MVPosition(Vector<Double> creates from angles (less than
or equal to two elements) or x,y,z (3 elements).
- MVPosition(Vector<Quantity> creates from length+angles,
angles, or x,y,z, depending on units.
A void adjust(Double) function normalises the vector to a length of 1;
a get() returns as a
Double 3-vector the length and angles of the position vector;
a getAngle() returns a Quantum 2-vector, (uInt) returns the indicated
element, and getValue returns the vector.
Positions can be added and subtracted.
The multiplication of two positions produces the in-product.
Example
See Mposition class.
Motivation
To do coordinate transformations
To Do
- See if not better to have a direction + length
Member Description
Default constructor generates a (0,0,0) position
MVPosition(const MVPosition &other)
Copy constructor
MVPosition(Double in0, Double in1, Double in2)
Creates a specified vector
explicit MVPosition(Double in0)
MVPosition(const Quantity &l)
Creates a vector with specified length towards pole
MVPosition(const Quantity &l, Double angle0, Double angle1)
Creates the position from specified (azimuth,elevation) angles and length
Creates the position from specified angles and length. or positions
Thrown Exceptions
- AipsError if quantities not in angle format
If not enough angles: pole assumed (if none), or elevation =0 (if 1)
MVPosition(const Quantity &l, const Quantity &angle0, const Quantity &angle1)
MVPosition(const Quantity &l, const Quantum<Quantum<Double> > &angle)
Creates the position from specified angles and length. or positions
Thrown Exceptions
- AipsError if quantities not in angle format
explicit MVPosition(const Vector<Double> &other)
MVPosition(const Vector<Quantity> &other)
Create from specified length and/or angles and/or position
MVPosition &operator=(const MVPosition &other)
Copy assignment
Destructor
Double operator*(const MVPosition &other) const
Multiplication defined as in-product
Bool operator== (const MVPosition &other) const
Bool operator!= (const MVPosition &other) const
Bool near(const MVPosition &other, Double tol=1e-13) const
Bool near(const MVPosition &other, Quantity tol) const
Bool nearAbs(const MVPosition &other, Double tol=1e-13) const
Equality comparisons
MVPosition operator-() const
MVPosition &operator+=(const MVPosition &right)
MVPosition operator+(const MVPosition &right) const
MVPosition &operator-=(const MVPosition &right)
MVPosition operator-(const MVPosition &right) const
Addition and subtraction
Multiplication with rotation matrix (see also global functions)
MVPosition &operator*=(Double right)
Multiplication with constant
Double &operator()(uInt which)
const Double &operator()(uInt which) const
Obtain an element
virtual uInt type() const
static void assure(const MeasValue &in)
Tell me your type
virtual void adjust(Double &res)
Normalise direction aspects by adjusting the length to 1
Adjustment with returned factor
virtual void readjust(Double res)
Normalise direction aspects by adjusting the length to 1
Re-adjust using factor given
virtual void adjust()
Normalise direction aspects by adjusting the length to 1
virtual Double radius()
Get radius of position
Generate a 3-vector of coordinates (length(m), angles(rad))
Generate a 3-vector of x,y,z in m
Generate angle 2-vector (in rad)
and with specified units
Double getLong() const
Get the longitudinal angle (in radians)
Quantity getLong(const Unit &unit) const
and with specified units
Double getLat() const
Get the latitude angle (rad)
Quantity getLat(const Unit &unit) const
and with specified units
Generate the length
Quantity getLength(const Unit &unit) const
and generate it with the specified units
Double positionAngle(const MVPosition &other) const
Quantity positionAngle(const MVPosition &other, const Unit &unit) const
Get the position angle between the directions. I.e. the angle between
the direction from one to the pole, and from one to the other.
Double separation(const MVPosition &other) const
Quantity separation(const MVPosition &other, const Unit &unit) const
Get the angular separation between two directions.
MVPosition crossProduct(const MVPosition &other) const
Produce the cross product
virtual void print(ostream &os) const
Print data
Clone
Get the value in internal units
virtual void putVector(const Vector<Double> &in)
Set the value from internal units (set 0 for empty vector)
Get the internal value as a Vector<Quantity>. Usable in
records. The getXRecordValue() gets additional information for records.
Note that the Vectors could be empty.
Set the internal value if correct values and dimensions
Double getLat(Double ln) const
Get the latitude assuming length is given