#include <SpatialVector.h>
Public Member Functions | |
SpatialVector () | |
constructs (1,0,0), ra=0, dec=0. | |
SpatialVector (float64 x, float64 y, float64 z) | |
Constructor from three coordinates, not necessarily normed to 1. | |
SpatialVector (float64 ra, float64 dec) | |
Constructor from ra/dec, this is always normed to 1. | |
SpatialVector (const SpatialVector &) | |
Copy constructor. | |
SpatialVector & | operator= (const SpatialVector &) |
Assignment. | |
void | set (const float64 &x, const float64 &y, const float64 &z) |
Set member function: set values - always normed to 1. | |
void | set (const float64 &ra, const float64 &dec) |
Set member function: set values - always normed to 1. | |
void | get (float64 &x, float64 &y, float64 &z) const |
Get x,y,z. | |
void | get (float64 &ra, float64 &dec) |
Get ra,dec - normalizes x,y,z. | |
float64 | length () const |
return length of vector | |
float64 | x () const |
return x (only as rvalue) | |
float64 | y () const |
return y | |
float64 | z () const |
return z | |
float64 | ra () |
return ra - this norms the vector to 1 if not already done so | |
float64 | dec () |
return dec - this norms the vector to 1 if not already done so | |
void | normalize () |
Normalize vector length to 1. | |
void | show () const |
Printf it to stdout. | |
void | read (istream &) |
Read vector from a stream. | |
void | write (ostream &) const |
Write vector to a stream. | |
int | operator== (const SpatialVector &) const |
Comparison. | |
float64 | operator* (const SpatialVector &) const |
dot product | |
SpatialVector | operator^ (const SpatialVector &) const |
cross product | |
SpatialVector | operator+ (const SpatialVector &) const |
addition | |
SpatialVector | operator- (const SpatialVector &) const |
subtraction | |
Private Member Functions | |
void | updateXYZ () |
void | updateRaDec () |
Private Attributes | |
float64 | x_ |
float64 | y_ |
float64 | z_ |
float64 | ra_ |
float64 | dec_ |
bool | okRaDec_ |
Friends | |
class | SpatialIndex |
class | SpatialDomain |
class | sxSpatialDomain |
operator *= | |
| |
SpatialVector | operator* (float64, const SpatialVector &) |
SpatialVector | operator* (int, const SpatialVector &) |
SpatialVector | operator* (const SpatialVector &, float64) |
SpatialVector | operator* (const SpatialVector &, int) |
SpatialVector & | operator*= (float64) |
SpatialVector & | operator*= (int) |
The SpatialVector is a 3D vector usually living on the surface of the sphere. The corresponding ra, dec can be obtained if the vector has unit length. That can be ensured with the normalize() function.
SpatialVector::SpatialVector | ( | ) |
constructs (1,0,0), ra=0, dec=0.
Referenced by operator+(), operator-(), and operator^().
Constructor from three coordinates, not necessarily normed to 1.
Constructor from ra/dec, this is always normed to 1.
References updateRaDec(), and updateXYZ().
SpatialVector::SpatialVector | ( | const SpatialVector & | vv | ) |
Copy constructor.
float64 SpatialVector::dec | ( | ) |
return dec - this norms the vector to 1 if not already done so
References dec_, normalize(), okRaDec_, and updateRaDec().
Get ra,dec - normalizes x,y,z.
References dec_, normalize(), okRaDec_, ra_, and updateRaDec().
float64 SpatialVector::length | ( | ) | const |
void SpatialVector::normalize | ( | ) |
Normalize vector length to 1.
Referenced by dec(), get(), SpatialIndex::idByPoint(), SpatialIndex::nodeVertex(), ra(), and set().
float64 SpatialVector::operator* | ( | const SpatialVector & | v | ) | const |
SpatialVector & SpatialVector::operator*= | ( | int | a | ) |
SpatialVector SpatialVector::operator+ | ( | const SpatialVector & | v | ) | const |
addition
References SpatialVector(), x_, y_, and z_.
SpatialVector SpatialVector::operator- | ( | const SpatialVector & | v | ) | const |
subtraction
References SpatialVector(), x_, y_, and z_.
SpatialVector & SpatialVector::operator= | ( | const SpatialVector & | vv | ) |
int SpatialVector::operator== | ( | const SpatialVector & | v | ) | const |
SpatialVector SpatialVector::operator^ | ( | const SpatialVector & | v | ) | const |
cross product
References SpatialVector(), x_, y_, and z_.
float64 SpatialVector::ra | ( | ) |
return ra - this norms the vector to 1 if not already done so
References normalize(), okRaDec_, ra_, and updateRaDec().
void SpatialVector::read | ( | istream & | in | ) |
Set member function: set values - always normed to 1.
References dec_, ra_, and updateXYZ().
Set member function: set values - always normed to 1.
References normalize(), updateRaDec(), x_, y_, and z_.
void SpatialVector::updateRaDec | ( | ) | [private] |
void SpatialVector::updateXYZ | ( | ) | [private] |
void SpatialVector::write | ( | ostream & | out | ) | const |
SpatialVector operator* | ( | const SpatialVector & | , | |
int | ||||
) | [friend] |
SpatialVector operator* | ( | const SpatialVector & | , | |
float64 | ||||
) | [friend] |
SpatialVector operator* | ( | int | , | |
const SpatialVector & | ||||
) | [friend] |
SpatialVector operator* | ( | float64 | , | |
const SpatialVector & | ||||
) | [friend] |
friend class SpatialDomain [friend] |
friend class SpatialIndex [friend] |
friend class sxSpatialDomain [friend] |
float64 SpatialVector::dec_ [private] |
Referenced by dec(), get(), operator=(), set(), updateRaDec(), and updateXYZ().
bool SpatialVector::okRaDec_ [private] |
Referenced by dec(), get(), operator*=(), operator=(), ra(), and updateRaDec().
float64 SpatialVector::ra_ [private] |
Referenced by get(), operator=(), ra(), set(), updateRaDec(), and updateXYZ().
float64 SpatialVector::x_ [private] |
Referenced by get(), length(), normalize(), operator*(), operator*(), operator*=(), operator+(), operator-(), operator=(), operator==(), operator^(), SpatialIndex::pointById(), read(), set(), show(), updateRaDec(), updateXYZ(), write(), and x().
float64 SpatialVector::y_ [private] |
Referenced by get(), length(), normalize(), operator*(), operator*(), operator*=(), operator+(), operator-(), operator=(), operator==(), operator^(), SpatialIndex::pointById(), read(), set(), show(), updateRaDec(), updateXYZ(), write(), and y().
float64 SpatialVector::z_ [private] |
Referenced by get(), length(), normalize(), operator*(), operator*(), operator*=(), operator+(), operator-(), operator=(), operator==(), operator^(), SpatialIndex::pointById(), read(), set(), show(), updateRaDec(), updateXYZ(), write(), and z().