GHorizDir.hpp
6.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
/***************************************************************************
* GHorizDir.hpp - Horizontal direction class *
* ----------------------------------------------------------------------- *
* copyright (C) 2014 by Karl Kosack *
* ----------------------------------------------------------------------- *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
/**
* @file GHorizDir.hpp
* @brief Horizontal direction class interface definition
* @author Karl Kosack
*/
#ifndef GHORIZDIR_HPP
#define GHORIZDIR_HPP
/* __ Includes ___________________________________________________________ */
#include <string>
#include "GBase.hpp"
#include "GVector.hpp"
#include "GMath.hpp"
/* __ Compile options ____________________________________________________ */
/***********************************************************************//**
* @class GHorizDir
*
* @brief 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.
***************************************************************************/
class GHorizDir : public GBase {
// Operator friends
friend bool operator==(const GHorizDir &a, const GHorizDir &b);
friend bool operator!=(const GHorizDir &a, const GHorizDir &b);
public:
// Constructors and destructors
GHorizDir(void);
GHorizDir(const GHorizDir& dir);
virtual ~GHorizDir(void);
// Operators
GHorizDir& operator=(const GHorizDir& dir);
// Methods
void clear(void);
GHorizDir* clone(void) const;
std::string classname(void) const;
void altaz(const double& alt, const double& az);
void altaz_deg(const double& alt, const double& az);
void celvector(const GVector& vector);
void rotate_deg(const double& phi, const double& theta);
const double& alt(void) const;
const double& az(void) const;
double zenith(void) const;
double zenith_deg(void) const;
double alt_deg(void) const;
double az_deg(void) const;
GVector celvector(void) const;
double dist(const GHorizDir& dir) const;
double dist_deg(const GHorizDir& dir) const;
std::string print(const GChatter& chatter = NORMAL) const;
private:
// Private methods
void init_members(void);
void copy_members(const GHorizDir& dir);
void free_members(void);
// Private members
double m_alt; //!< altitude in radians
double m_az; //!< azimuth in radians
};
/***********************************************************************//**
* @brief Return class name
*
* @return String containing the class name ("GHorizDir").
***************************************************************************/
inline
std::string GHorizDir::classname(void) const
{
return ("GHorizDir");
}
/***********************************************************************//**
* @brief Return zenith angle in radians
*
* @return zenith angle in radians.
***************************************************************************/
inline
double GHorizDir::zenith() const
{
return (gammalib::pihalf - m_alt);
}
/***********************************************************************//**
* @brief Return zenith angle in degrees
*
* @return zenith angle in degrees.
***************************************************************************/
inline
double GHorizDir::zenith_deg() const
{
return (zenith() * gammalib::rad2deg);
}
/***********************************************************************//**
* @brief Return altitude angle in radians
*
* @return Altitude angle in radians.
***************************************************************************/
inline
const double& GHorizDir::alt() const
{
return m_alt;
}
/***********************************************************************//**
* @brief Return altitude angle in degrees
*
* @return Altitude angle in degrees.
***************************************************************************/
inline
double GHorizDir::alt_deg() const
{
return (m_alt * gammalib::rad2deg);
}
/***********************************************************************//**
* @brief Return azimuth angle in radians
*
* @return Azimuth angle in radians.
***************************************************************************/
inline
const double& GHorizDir::az() const
{
return m_az;
}
/***********************************************************************//**
* @brief Return azimuth angle in degrees
*
* @return Azimuth angle in degrees.
***************************************************************************/
inline
double GHorizDir::az_deg() const
{
return (m_az * gammalib::rad2deg);
}
#endif /* GHORIZDIR_HPP */