GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GHorizDir Class Reference

Horizontal (Alt/Az) direction class. More...

#include <GHorizDir.hpp>

Inheritance diagram for GHorizDir:
GBase

Public Member Functions

 GHorizDir (void)
 Constructor. More...
 
 GHorizDir (const GHorizDir &dir)
 Copy constructor. More...
 
virtual ~GHorizDir (void)
 Destructor. More...
 
GHorizDiroperator= (const GHorizDir &dir)
 Assignment operator. More...
 
void clear (void)
 Clear horizontal direction. More...
 
GHorizDirclone (void) const
 Clone horizontal direction. More...
 
std::string classname (void) const
 Return class name. More...
 
void altaz (const double &alt, const double &az)
 Set horizontal direction (radians) More...
 
void altaz_deg (const double &alt, const double &az)
 Set horizontal direction (degrees) More...
 
void celvector (const GVector &vector)
 Set horizontal direction from 3D vector. More...
 
void rotate_deg (const double &phi, const double &theta)
 Rotate horizontal direction by zenith and azimuth angle. More...
 
const double & alt (void) const
 Return altitude angle in radians. More...
 
const double & az (void) const
 Return azimuth angle in radians. More...
 
double zenith (void) const
 Return zenith angle in radians. More...
 
double zenith_deg (void) const
 Return zenith angle in degrees. More...
 
double alt_deg (void) const
 Return altitude angle in degrees. More...
 
double az_deg (void) const
 Return azimuth angle in degrees. More...
 
GVector celvector (void) const
 Return horizontal direction as 3D vector. More...
 
double dist (const GHorizDir &dir) const
 Compute angular distance to horizontal direction in radians. More...
 
double dist_deg (const GHorizDir &dir) const
 Compute angular distance to horizontal direction in degrees. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print horizontal direction information. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Private Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GHorizDir &dir)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Private Attributes

double m_alt
 altitude in radians More...
 
double m_az
 azimuth in radians More...
 

Friends

bool operator== (const GHorizDir &a, const GHorizDir &b)
 Equality operator. More...
 
bool operator!= (const GHorizDir &a, const GHorizDir &b)
 Non equality operator. More...
 

Detailed Description

Horizontal (Alt/Az) direction class.

This class is essentially a copy of GSkyDir and implements a spherical coordinate on the sky, in horizontal coordinates as seen from Earth.

Note
since this class shares much functionality with GSkyDir, a common base-class should probably be created in the future to avoid duplication of code.

Definition at line 52 of file GHorizDir.hpp.

Constructor & Destructor Documentation

GHorizDir::GHorizDir ( void  )

Constructor.

Definition at line 59 of file GHorizDir.cpp.

References init_members().

Referenced by clone().

GHorizDir::GHorizDir ( const GHorizDir dir)

Copy constructor.

Parameters
[in]dirHorizontal direction.

Definition at line 74 of file GHorizDir.cpp.

References copy_members(), and init_members().

GHorizDir::~GHorizDir ( void  )
virtual

Destructor.

Definition at line 90 of file GHorizDir.cpp.

References free_members().

Member Function Documentation

const double & GHorizDir::alt ( void  ) const
inline

Return altitude angle in radians.

Returns
Altitude angle in radians.

Definition at line 140 of file GHorizDir.hpp.

References m_alt.

Referenced by altaz(), and dist().

double GHorizDir::alt_deg ( void  ) const
inline

Return altitude angle in degrees.

Returns
Altitude angle in degrees.

Definition at line 152 of file GHorizDir.hpp.

References m_alt, and gammalib::rad2deg.

void GHorizDir::altaz ( const double &  alt,
const double &  az 
)

Set horizontal direction (radians)

Parameters
[in]altAltitude in radians.
[in]azAzimuth in radians.

Sets Altitude and Azimuth in radians.

Definition at line 175 of file GHorizDir.cpp.

References alt(), az(), m_alt, and m_az.

void GHorizDir::altaz_deg ( const double &  alt,
const double &  az 
)

Set horizontal direction (degrees)

Parameters
[in]altAltitude in radians.
[in]azAzimuth in radians.

Sets Altitude and Azimuth in degrees.

Definition at line 195 of file GHorizDir.cpp.

References gammalib::deg2rad, m_alt, and m_az.

const double & GHorizDir::az ( void  ) const
inline

Return azimuth angle in radians.

Returns
Azimuth angle in radians.

Definition at line 164 of file GHorizDir.hpp.

References m_az.

Referenced by altaz(), and dist().

double GHorizDir::az_deg ( void  ) const
inline

Return azimuth angle in degrees.

Returns
Azimuth angle in degrees.

Definition at line 176 of file GHorizDir.hpp.

References m_az, and gammalib::rad2deg.

void GHorizDir::celvector ( const GVector vector)

Set horizontal direction from 3D vector.

Parameters
[in]vector3D vector.

Convert a 3-dimensional vector in into a horizontal direction. The transformation is given by

\[ \alpha = \arctan \left( \frac{x_1}{x_0} \right) \]

\[ \delta = \arcsin x_2 \]

Definition at line 223 of file GHorizDir.cpp.

References asin(), gammalib::atan2(), m_alt, and m_az.

GVector GHorizDir::celvector ( void  ) const

Return horizontal direction as 3D vector.

Returns
Horizontal direction as 3D vector.

Definition at line 282 of file GHorizDir.cpp.

References cos(), m_alt, m_az, and sin().

Referenced by rotate_deg().

std::string GHorizDir::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GHorizDir").

Implements GBase.

Definition at line 104 of file GHorizDir.hpp.

void GHorizDir::clear ( void  )
virtual

Clear horizontal direction.

Implements GBase.

Definition at line 142 of file GHorizDir.cpp.

References free_members(), and init_members().

GHorizDir * GHorizDir::clone ( void  ) const
virtual

Clone horizontal direction.

Returns
Pointer to deep copy of horizontal direction.

Implements GBase.

Definition at line 160 of file GHorizDir.cpp.

References GHorizDir().

void GHorizDir::copy_members ( const GHorizDir dir)
private

Copy class members.

Parameters
[in]dirHorizontal direction.

Definition at line 387 of file GHorizDir.cpp.

References m_alt, and m_az.

Referenced by GHorizDir(), and operator=().

double GHorizDir::dist ( const GHorizDir dir) const

Compute angular distance to horizontal direction in radians.

Parameters
[in]dirHorizontal direction.
Returns
Angular distance in radians.

Computes the angular distance to a specified horizontal direction in radians.

Definition at line 305 of file GHorizDir.cpp.

References gammalib::acos(), alt(), az(), cos(), m_alt, m_az, and sin().

Referenced by dist_deg().

double GHorizDir::dist_deg ( const GHorizDir dir) const

Compute angular distance to horizontal direction in degrees.

Parameters
[in]dirHorizontal direction.
Returns
Angular distance in degrees.

Computes the angular distance to a specified horizontal direction in degrees.

Definition at line 329 of file GHorizDir.cpp.

References dist(), and gammalib::rad2deg.

void GHorizDir::free_members ( void  )
private

Delete class members.

Definition at line 401 of file GHorizDir.cpp.

Referenced by clear(), operator=(), and ~GHorizDir().

void GHorizDir::init_members ( void  )
private

Initialise class members.

Definition at line 371 of file GHorizDir.cpp.

References m_alt, and m_az.

Referenced by clear(), GHorizDir(), and operator=().

GHorizDir & GHorizDir::operator= ( const GHorizDir dir)

Assignment operator.

Parameters
[in]dirHorizontal direction.
Returns
Horizontal direction.

Definition at line 112 of file GHorizDir.cpp.

References copy_members(), free_members(), and init_members().

std::string GHorizDir::print ( const GChatter chatter = NORMAL) const
virtual

Print horizontal direction information.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing horizontal direction information.

Implements GBase.

Definition at line 343 of file GHorizDir.cpp.

References m_alt, m_az, gammalib::rad2deg, SILENT, and gammalib::str().

void GHorizDir::rotate_deg ( const double &  phi,
const double &  theta 
)

Rotate horizontal direction by zenith and azimuth angle.

Parameters
[in]phiAzimuth angle (deg).
[in]thetaZenith angle (deg).

Rotate horizontal direction by a zenith and azimuth angle given in the system of the horizontal direction and aligned in TBD. The azimuth angle is counted counter clockwise from TBD.

Definition at line 244 of file GHorizDir.cpp.

References celvector(), cos(), gammalib::deg2rad, GMatrix::eulery(), GMatrix::eulerz(), m_alt, m_az, gammalib::rad2deg, and sin().

double GHorizDir::zenith ( void  ) const
inline

Return zenith angle in radians.

Returns
zenith angle in radians.

Definition at line 116 of file GHorizDir.hpp.

References m_alt, and gammalib::pihalf.

Referenced by zenith_deg().

double GHorizDir::zenith_deg ( void  ) const
inline

Return zenith angle in degrees.

Returns
zenith angle in degrees.

Definition at line 128 of file GHorizDir.hpp.

References gammalib::rad2deg, and zenith().

Friends And Related Function Documentation

bool operator!= ( const GHorizDir a,
const GHorizDir b 
)
friend

Non equality operator.

Parameters
[in]aFirst horizontal direction.
[in]bSecond horizontal direction.

Definition at line 449 of file GHorizDir.cpp.

bool operator== ( const GHorizDir a,
const GHorizDir b 
)
friend

Equality operator.

Parameters
[in]aFirst horizontal direction.
[in]bSecond horizontal direction.

Compare two horizontal directions. If the coordinate is at the pole, the azimuth value is irrelevant.

Todo:
: really should test for being within some tolerance here

Definition at line 425 of file GHorizDir.cpp.

Member Data Documentation

double GHorizDir::m_alt
private

altitude in radians

Definition at line 93 of file GHorizDir.hpp.

Referenced by alt(), alt_deg(), altaz(), altaz_deg(), celvector(), copy_members(), dist(), init_members(), operator==(), print(), rotate_deg(), and zenith().

double GHorizDir::m_az
private

azimuth in radians

Definition at line 94 of file GHorizDir.hpp.

Referenced by altaz(), altaz_deg(), az(), az_deg(), celvector(), copy_members(), dist(), init_members(), operator==(), print(), and rotate_deg().


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