Loading...
Searching...
No Matches
casacore::MVDirection Class Reference
casa package (libcasa_casa) » Quanta_module

More...

`#include <MVDirection.h>`

## Public Member Functions

| MVDirection ()
| Default constructor generates a direction to the pole (i.e.
| MVDirection (const MVPosition &other)
| Creates from an MVPosition.
| MVDirection (Double in0)
| Constructs with elevation = 0.
| MVDirection (const Quantity &angle0)
| MVDirection (Double in0, Double in1, Double in2)
| Creates a specified vector.
| MVDirection (Double angle0, Double angle1)
| Creates the direction cosines from specified angles along equator (azimuth) and towards pole (,elevation).
| MVDirection (const Quantity &angle0, const Quantity &angle1)
| Creates the direction cosines from specified angles.
| MVDirection (const Quantum< Vector< Double > > &angle)
| If not enough angles: pole (=(0,0,1)) assumed (if none), or elevation =0 (if 1); direction cosines assumed (if 3).
| MVDirection (const Vector< Double > &other)
| Create from Vector.
| MVDirection (const Vector< Quantity > &other)
MVDirection & | operator+= (const MVDirection &right)
| Addition and subtraction.
MVDirection | operator+ (const MVDirection &right) const
MVDirection & | operator-= (const MVDirection &right)
MVDirection | operator- (const MVDirection &right) const
virtual void | adjust ()
| Adjust the direction cosines to a length of 1.
virtual void | adjust (Double &res)
| Adjust the direction cosines to a length of 1 and return the length value.
virtual MeasValue * | clone () const
| Re-adjust : taken from MVPosition.
Vector< Double > | get () const
| Generate a 2-vector of angles (in rad).
Double | getLat () const
| Get the latitude angle (rad).
Quantity | getLat (const Unit &unit) const
| and with specified units
Double | positionAngle (const MVPosition &other) const
| Get the position angle between the directions.
Double | positionAngle (const MVDirection &other) const
Quantity | positionAngle (const MVPosition &other, const Unit &unit) const
Quantity | positionAngle (const MVDirection &other, const Unit &unit) const
Double | separation (const MVPosition &other) const
| Get the angular separation between two directions.
Double | separation (const MVDirection &other) const
Quantity | separation (const MVPosition &other, const Unit &unit) const
Quantity | separation (const MVDirection &other, const Unit &unit) const
MVDirection | crossProduct (const MVDirection &other) const
| Produce the cross product.
virtual Vector< Quantum< Double > > | getRecordValue () const
| Get the internal value as a Vector<Quantity>.
virtual Vector< Quantum< Double > > | getXRecordValue () const
virtual Vector< Quantum< Double > > | getTMRecordValue () const
virtual Bool | putValue (const Vector< Quantum< Double > > &in)
| Set the internal value if correct values and dimensions.
void | setAngle (Double angle0, Double angle1)
| Set the internal value, using the longitude and latitude (in rad) given.
void | shift (const Quantum< Double > &lng, const Quantum< Double > &lat, Bool trueAngle=False)
| Shift the direction in longitude (radians if Double) and/or latitude.
void | shift (Double lng, Double lat, Bool trueAngle=False)
void | shiftLongitude (const Quantity &lng, Bool trueAngle=False)
void | shiftLongitude (Double lng, Bool trueAngle=False)
void | shiftLatitude (const Quantum< Double > &lat, Bool trueAngle=False)
void | shiftLatitude (Double lat, Bool trueAngle=False)
void | shift (const MVDirection &shft, Bool trueAngle=False)
void | shiftAngle (const Quantum< Double > &off, const Quantum< Double > &pa)
| Shift over an angle off in the direction pa.
void | shiftAngle (Double off, Double pa)
Public Member Functions inherited from casacore::MVPosition
| MVPosition ()
| 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.
| MVPosition (Double in0)
| Creates a vector with specified length towards pole.
| MVPosition (const Quantity &l)
| MVPosition (const Quantity &l, Double angle0, Double angle1)
| Creates the position from specified (azimuth,elevation) angles and length.
| MVPosition (const Quantity &l, const Quantity &angle0, const Quantity &angle1)
| Creates the position from specified angles and length.
| MVPosition (const Quantum< Vector< Double > > &angle)
| If not enough angles: pole assumed (if none), or elevation =0 (if 1).
| MVPosition (const Quantity &l, const Quantum< Vector< Double > > &angle)
| MVPosition (const Vector< Double > &other)
| Create from specified length and/or angles and/or position.
| MVPosition (const Vector< Quantity > &other)
MVPosition & | operator= (const MVPosition &other)
| Copy assignment.
virtual | ~MVPosition ()
| Destructor.
Double | operator* (const MVPosition &other) const
| Multiplication defined as in-product.
Bool | operator== (const MVPosition &other) const
| Equality comparisons.
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
| Addition and subtraction.
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)
| Multiplication with rotation matrix (see also global functions).
MVPosition & | operator*= (Double right)
| Multiplication with constant.
Double & | operator() (uInt which)
| Obtain an element.
const Double & | operator() (uInt which) const
virtual void | readjust (Double res)
| Re-adjust using factor given.
virtual Double | radius ()
| Get radius of position.
Vector< Double > | get () const
| Generate a 3-vector of coordinates (length(m), angles(rad)).
const Vector< Double > & | getValue () const
| Generate a 3-vector of x,y,z in m.
Quantum< Vector< Double > > | getAngle () const
| Generate angle 2-vector (in rad).
Quantum< Vector< Double > > | getAngle (const Unit &unit) const
| 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
Quantity | getLength () const
| Generate the length.
Quantity | getLength (const Unit &unit) const
| and generate it with the specified units
Double | positionAngle (const MVPosition &other) const
| Get the position angle between the directions.
Quantity | positionAngle (const MVPosition &other, const Unit &unit) const
Double | separation (const MVPosition &other) const
| Get the angular separation between two directions.
Quantity | separation (const MVPosition &other, const Unit &unit) const
MVPosition | crossProduct (const MVPosition &other) const
| Produce the cross product.
virtual void | print (ostream &os) const
| Print data.
virtual Vector< Double > | getVector () const
| Get the value in internal units.
virtual void | putVector (const Vector< Double > &in)
| Set the value from internal units (set 0 for empty vector).
Public Member Functions inherited from casacore::MeasValue
void | dummy_constr () const
| Each derived class should have at least the following constructors:
virtual | ~MeasValue ()
| Destructor.
void | dummy_operator () const
| The following operators should be present at least.

## Static Public Member Functions

static void | assure (const MeasValue &in)
| Tell me your type.
Static Public Member Functions inherited from casacore::MVPosition
static void | assure (const MeasValue &in)
| Tell me your type.

## Additional Inherited Members

Static Public Attributes inherited from casacore::MVPosition
static const Double | loLimit
| Internal limts codes for negative height.
static const Double | hiLimit
Protected Member Functions inherited from casacore::MVPosition
Double | getLat (Double ln) const
| Get the latitude assuming length is given.
Protected Attributes inherited from casacore::MVPosition
Vector< Double > | xyz
| Position vector (in m).

## Detailed Description

Vector of three direction cosines

### Intended use:

Public interface

### Review Status

Reviewed By:
  tcornwel
Date Reviewed:
  1996/02/22
Test programs:
  tMeasMath

### Prerequisite

- MVPosition
- Vector
- Quantum

### Etymology

From Measure, Value and Direction

### Synopsis

An MVDirection is a 3-vector of direction cosines. It is based on the MVposition class. The main difference is that the length of the vector will be adjusted (normalised) to a length of 1 in all operations. It can be constructed with:

- MVDirection() creates direction cosines for pole: (0,0,1)
- MVDirection(MVDirection) creates a copy
- MVDirection(MVPosition) creates (x,y,z) from the given position
- MVDirection(Double, Double, Double) creates with specified values and adjust to length of 1.
- MVDirection(Double, Double) creates a MVDirection assuming that the two values are (in radians) angle along 'equator' and towards 'pole'.
- MVDirection(Quantity, Quantity) creates a MVDirection assuming angles as in previous
- MVDirection(Quantum<Vector<Double> >) creates an MVDirection from angle vector, assuming second as zero if not present, and pole if length 0. Assumes a direction cosine if 3 elements
- MVDirection(Vector<Double>) creates an MVDirection with the same restrictions as previous one
- MVDirection(Vector<Quantum<Double> >) creates an MVDirection with the same rstrictions as previous one; but with unit check.

A void adjust() function normalises the vector to a length of 1; a get() returns as a Double 2-vector the angles of the direction cosines; a getAngle() returns a Quantum 2-vector, (uInt) returns the indicated element, and getValue returns the direction cosine vector.
Direction cosines can be added and subtracted: the result will be adjusted to a length of 1.
The multiplication of two direction cosines produces the inner product.
shift() methods are available to shift in angular coordinates. E.g. shift(Quantity(5, "arcsec"), Quantity(-7, "arcsec")) will shift 5 arcsec in longitude, and -7 arcsec in latitude. They have a trueAngle switch to shift in latitude and perpendicular (along a great circle) to it.

### Example

See MDirection

### Motivation

To aid coordinate transformations

### To Do

- check if true shifts can be done faster

Definition at line 105 of file MVDirection.h.

## Constructor & Destructor Documentation

## MVDirection() [1/10]

casacore::MVDirection::MVDirection | ( |  | ) |

Default constructor generates a direction to the pole (i.e.

(0,0,1))

Referenced by crossProduct(), operator+(), operator+=(), operator-(), operator-=(), positionAngle(), positionAngle(), separation(), separation(), and shift().

## MVDirection() [2/10]

casacore::MVDirection::MVDirection | ( | const MVPosition & | other | ) |

Creates from an MVPosition.

References casacore::MVPosition::MVPosition().

## MVDirection() [3/10]

casacore::MVDirection::MVDirection | ( | Double | in0 | ) |

Constructs with elevation = 0.

## MVDirection() [4/10]

casacore::MVDirection::MVDirection | ( | const Quantity & | angle0 | ) |

## MVDirection() [5/10]

casacore::MVDirection::MVDirection | ( | Double | in0,
|  | Double | in1,
|  | Double | in2 )

Creates a specified vector.

## MVDirection() [6/10]

casacore::MVDirection::MVDirection | ( | Double | angle0,
|  | Double | angle1 )

Creates the direction cosines from specified angles along equator (azimuth) and towards pole (,elevation).

## MVDirection() [7/10]

casacore::MVDirection::MVDirection | ( | const Quantity & | angle0,
|  | const Quantity & | angle1 )

Creates the direction cosines from specified angles.

### Thrown Exceptions

- AipsError if quantities not in angle format

## MVDirection() [8/10]

casacore::MVDirection::MVDirection | ( | const Quantum< Vector< Double > > & | angle | ) |

If not enough angles: pole (=(0,0,1)) assumed (if none), or elevation =0 (if 1); direction cosines assumed (if 3).

### Thrown Exceptions

- AipsError if more than 3 values or incorrect units

## MVDirection() [9/10]

casacore::MVDirection::MVDirection | ( | const Vector< Double > & | other | ) |

Create from Vector.

Assumes angles if less than or equal than 2 elements. Assumes direction cosines if 3 elements.

### Thrown Exceptions

- AipsError if more than 3 elements

## MVDirection() [10/10]

casacore::MVDirection::MVDirection | ( | const Vector< Quantity > & | other | ) |

## Member Function Documentation

## adjust() [1/2]

virtual void casacore::MVDirection::adjust | ( |  | ) |

virtual

Adjust the direction cosines to a length of 1.

Reimplemented from casacore::MVPosition.

## adjust() [2/2]

virtual void casacore::MVDirection::adjust | ( | Double & | res | ) |

virtual

Adjust the direction cosines to a length of 1 and return the length value.

Reimplemented from casacore::MVPosition.

## assure()

void casacore::MVDirection::assure | ( | const MeasValue & | in | ) |

static

Tell me your type.

## clone()

virtual MeasValue * casacore::MVDirection::clone | ( |  | ) | const

virtual

Re-adjust : taken from MVPosition.

Clone data

Reimplemented from casacore::MVPosition.

## crossProduct()

MVDirection casacore::MVDirection::crossProduct | ( | const MVDirection & | other | ) | const

Produce the cross product.

References MVDirection().

## get()

Vector< Double > casacore::MVDirection::get | ( |  | ) | const

Generate a 2-vector of angles (in rad).

## getLat() [1/2]

Double casacore::MVDirection::getLat | ( |  | ) | const

Get the latitude angle (rad).

## getLat() [2/2]

Quantity casacore::MVDirection::getLat | ( | const Unit & | unit | ) | const

and with specified units

## getRecordValue()

virtual Vector< Quantum< Double > > casacore::MVDirection::getRecordValue | ( |  | ) | const

virtual

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.

Reimplemented from casacore::MVPosition.

## getTMRecordValue()

virtual Vector< Quantum< Double > > casacore::MVDirection::getTMRecordValue | ( |  | ) | const

virtual

Reimplemented from casacore::MVPosition.

## getXRecordValue()

virtual Vector< Quantum< Double > > casacore::MVDirection::getXRecordValue | ( |  | ) | const

virtual

Reimplemented from casacore::MVPosition.

## operator+()

MVDirection casacore::MVDirection::operator+ | ( | const MVDirection & | right | ) | const

References MVDirection().

## operator+=()

MVDirection & casacore::MVDirection::operator+= | ( | const MVDirection & | right | ) |

Addition and subtraction.

References MVDirection().

## operator-()

MVDirection casacore::MVDirection::operator- | ( | const MVDirection & | right | ) | const

References MVDirection().

## operator-=()

MVDirection & casacore::MVDirection::operator-= | ( | const MVDirection & | right | ) |

References MVDirection().

## positionAngle() [1/4]

Double casacore::MVDirection::positionAngle | ( | const MVDirection & | other | ) | const

References MVDirection().

## positionAngle() [2/4]

Quantity casacore::MVDirection::positionAngle | ( | const MVDirection & | other,
|  | const Unit & | unit ) const

References MVDirection().

## positionAngle() [3/4]

Double casacore::MVDirection::positionAngle | ( | const MVPosition & | other | ) | 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.

References casacore::MVPosition::MVPosition().

## positionAngle() [4/4]

Quantity casacore::MVDirection::positionAngle | ( | const MVPosition & | other,
|  | const Unit & | unit ) const

References casacore::MVPosition::MVPosition().

## putValue()

virtual Bool casacore::MVDirection::putValue | ( | const Vector< Quantum< Double > > & | in | ) |

virtual

Set the internal value if correct values and dimensions.

Reimplemented from casacore::MVPosition.

## separation() [1/4]

Double casacore::MVDirection::separation | ( | const MVDirection & | other | ) | const

References MVDirection().

## separation() [2/4]

Quantity casacore::MVDirection::separation | ( | const MVDirection & | other,
|  | const Unit & | unit ) const

References MVDirection().

## separation() [3/4]

Double casacore::MVDirection::separation | ( | const MVPosition & | other | ) | const

Get the angular separation between two directions.

References casacore::MVPosition::MVPosition().

## separation() [4/4]

Quantity casacore::MVDirection::separation | ( | const MVPosition & | other,
|  | const Unit & | unit ) const

References casacore::MVPosition::MVPosition().

## setAngle()

void casacore::MVDirection::setAngle | ( | Double | angle0,
|  | Double | angle1 )

Set the internal value, using the longitude and latitude (in rad) given.

## shift() [1/3]

void casacore::MVDirection::shift | ( | const MVDirection & | shft,
|  | Bool | trueAngle = False )

References casacore::False, and MVDirection().

## shift() [2/3]

void casacore::MVDirection::shift | ( | const Quantum< Double > & | lng,
|  | const Quantum< Double > & | lat,
|  | Bool | trueAngle = False )

Shift the direction in longitude (radians if Double) and/or latitude.

If the trueAngle switch is True, the longitude shift will be in angular units perpendicular to the direction to the pole at the shifted latitude, along a great circle.

References casacore::False.

## shift() [3/3]

void casacore::MVDirection::shift | ( | Double | lng,
|  | Double | lat,
|  | Bool | trueAngle = False )

References casacore::False.

## shiftAngle() [1/2]

void casacore::MVDirection::shiftAngle | ( | const Quantum< Double > & | off,
|  | const Quantum< Double > & | pa )

Shift over an angle off in the direction pa.

pa is measured from North, in the direction of increasing longitude.

References casacore::pa().

## shiftAngle() [2/2]

void casacore::MVDirection::shiftAngle | ( | Double | off,
|  | Double | pa )

References casacore::pa().

## shiftLatitude() [1/2]

void casacore::MVDirection::shiftLatitude | ( | const Quantum< Double > & | lat,
|  | Bool | trueAngle = False )

References casacore::False.

## shiftLatitude() [2/2]

void casacore::MVDirection::shiftLatitude | ( | Double | lat,
|  | Bool | trueAngle = False )

References casacore::False.

## shiftLongitude() [1/2]

void casacore::MVDirection::shiftLongitude | ( | const Quantity & | lng,
|  | Bool | trueAngle = False )

References casacore::False.

## shiftLongitude() [2/2]

void casacore::MVDirection::shiftLongitude | ( | Double | lng,
|  | Bool | trueAngle = False )

References casacore::False.

The documentation for this class was generated from the following file:

- casa/Quanta/MVDirection.h