SpatialVector.h



Classes

SpatialVector -- Spatial Vector class (full description)

class SpatialVector

Interface

Public Members
SpatialVector()
SpatialVector(float64 x, float64 y, float64 z)
SpatialVector(float64 ra, float64 dec)
SpatialVector(const SpatialVector &)
SpatialVector& operator =(const SpatialVector &)
void set(const float64 &x, const float64 &y, const float64 &z)
void set(const float64 &ra, const float64 &dec)
void get( float64 &x, float64 &y, float64 &z) const
void get( float64 &ra, float64 &dec)
float64 length() const
float64 x() const
float64 y() const
float64 z() const
float64 ra()
float64 dec()
void normalize()
void show() const
void read(istream &)
void write(ostream &) const
int operator ==(const SpatialVector & ) const
float64 operator *(const SpatialVector & ) const
SpatialVector operator +(const SpatialVector & ) const
SpatialVector operator -(const SpatialVector & ) const
SpatialVector & operator *=(float64)
SpatialVector & operator *=(int)
friend SpatialVector operator *(float64, const SpatialVector &)
friend SpatialVector operator *(int, const SpatialVector &)
friend SpatialVector operator *(const SpatialVector &, float64)
friend SpatialVector operator *(const SpatialVector &, int)
Private Members
void updateXYZ()
void updateRaDec()

Description

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.

Member Description

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

addition

SpatialVector operator -(const SpatialVector & ) const

subtraction

SpatialVector & operator *=(float64)

scalar products with int and float

SpatialVector & operator *=(int)

friend SpatialVector operator *(float64, const SpatialVector &)

friend SpatialVector operator *(int, const SpatialVector &)

friend SpatialVector operator *(const SpatialVector &, float64)

friend SpatialVector operator *(const SpatialVector &, int)

void updateXYZ()

void updateRaDec()


© Copyright The Johns Hopkins University 1999, All Rights Reserved.
Peter Z. Kunszt,