GammaLib
2.0.0
|
Horizontal (Alt/Az) direction class. More...
#include <GHorizDir.hpp>
Public Member Functions | |
GHorizDir (void) | |
Constructor. More... | |
GHorizDir (const GHorizDir &dir) | |
Copy constructor. More... | |
virtual | ~GHorizDir (void) |
Destructor. More... | |
GHorizDir & | operator= (const GHorizDir &dir) |
Assignment operator. More... | |
void | clear (void) |
Clear horizontal direction. More... | |
GHorizDir * | clone (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... | |
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.
Definition at line 52 of file GHorizDir.hpp.
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.
[in] | dir | Horizontal direction. |
Definition at line 74 of file GHorizDir.cpp.
References copy_members(), and init_members().
|
virtual |
|
inline |
Return altitude angle in radians.
Definition at line 140 of file GHorizDir.hpp.
References m_alt.
|
inline |
Return 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 | ||
) |
void GHorizDir::altaz_deg | ( | const double & | alt, |
const double & | az | ||
) |
Set horizontal direction (degrees)
[in] | alt | Altitude in radians. |
[in] | az | Azimuth in radians. |
Sets Altitude and Azimuth in degrees.
Definition at line 195 of file GHorizDir.cpp.
References gammalib::deg2rad, m_alt, and m_az.
|
inline |
Return azimuth angle in radians.
Definition at line 164 of file GHorizDir.hpp.
References m_az.
|
inline |
Return 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.
[in] | vector | 3D 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.
Definition at line 282 of file GHorizDir.cpp.
References cos(), m_alt, m_az, and sin().
Referenced by rotate_deg().
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 104 of file GHorizDir.hpp.
|
virtual |
Clear horizontal direction.
Implements GBase.
Definition at line 142 of file GHorizDir.cpp.
References free_members(), and init_members().
|
virtual |
Clone horizontal direction.
Implements GBase.
Definition at line 160 of file GHorizDir.cpp.
References GHorizDir().
|
private |
Copy class members.
[in] | dir | Horizontal direction. |
Definition at line 387 of file GHorizDir.cpp.
Referenced by GHorizDir(), and operator=().
double GHorizDir::dist | ( | const GHorizDir & | dir | ) | const |
Compute angular distance to horizontal direction in radians.
[in] | dir | Horizontal direction. |
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.
[in] | dir | Horizontal direction. |
Computes the angular distance to a specified horizontal direction in degrees.
Definition at line 329 of file GHorizDir.cpp.
References dist(), and gammalib::rad2deg.
|
private |
Delete class members.
Definition at line 401 of file GHorizDir.cpp.
Referenced by clear(), operator=(), and ~GHorizDir().
|
private |
Initialise class members.
Definition at line 371 of file GHorizDir.cpp.
Referenced by clear(), GHorizDir(), and operator=().
Assignment operator.
[in] | dir | Horizontal direction. |
Definition at line 112 of file GHorizDir.cpp.
References copy_members(), free_members(), and init_members().
Print horizontal direction information.
[in] | chatter | Chattiness (defaults to NORMAL). |
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.
[in] | phi | Azimuth angle (deg). |
[in] | theta | Zenith 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().
|
inline |
Return zenith angle in radians.
Definition at line 116 of file GHorizDir.hpp.
References m_alt, and gammalib::pihalf.
Referenced by zenith_deg().
|
inline |
Return zenith angle in degrees.
Definition at line 128 of file GHorizDir.hpp.
References gammalib::rad2deg, and zenith().
Non equality operator.
[in] | a | First horizontal direction. |
[in] | b | Second horizontal direction. |
Definition at line 449 of file GHorizDir.cpp.
Equality operator.
[in] | a | First horizontal direction. |
[in] | b | Second horizontal direction. |
Compare two horizontal directions. If the coordinate is at the pole, the azimuth value is irrelevant.
Definition at line 425 of file GHorizDir.cpp.
|
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().
|
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().