A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
angles.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011, 2012 CTTC
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
20#ifndef ANGLES_H
21#define ANGLES_H
22
23#include <ns3/vector.h>
24
25#include <vector>
26
27namespace ns3
28{
29
36double DegreesToRadians(double degrees);
37
44std::vector<double> DegreesToRadians(const std::vector<double>& degrees);
45
52double RadiansToDegrees(double radians);
53
60std::vector<double> RadiansToDegrees(const std::vector<double>& radians);
61
68double WrapTo360(double a);
69
76double WrapTo180(double a);
77
84double WrapTo2Pi(double a);
85
92double WrapToPi(double a);
93
118{
119 public:
128 Angles(double azimuth, double inclination);
129
139 Angles(Vector v);
140
149 Angles(Vector v, Vector o);
150
156 void SetAzimuth(double azimuth);
157
163 void SetInclination(double inclination);
164
170 double GetAzimuth() const;
171
177 double GetInclination() const;
178
179 // friend methods
187 friend std::ostream& operator<<(std::ostream& os, const Angles& a);
195 friend std::istream& operator>>(std::istream& is, Angles& a);
196
197 static bool m_printDeg;
198
199 private:
203 Angles();
204
214 void NormalizeAngles();
215
221 void CheckIfValid() const;
222
223 double m_azimuth;
225};
226
227} // namespace ns3
228
229#endif // ANGLES_H
Class holding the azimuth and inclination angles of spherical coordinates.
Definition: angles.h:118
void NormalizeAngles()
Normalize the angle azimuth angle range between in [-M_PI, M_PI) while checking if the angle is valid...
Definition: angles.cc:222
double m_inclination
the inclination angle in radians
Definition: angles.h:224
double GetInclination() const
Getter for inclination angle.
Definition: angles.cc:216
friend std::istream & operator>>(std::istream &is, Angles &a)
Stream extraction operator.
Definition: angles.cc:153
static bool m_printDeg
flag for printing in radians or degrees units
Definition: angles.h:197
void SetAzimuth(double azimuth)
Setter for azimuth angle.
Definition: angles.cc:196
Angles()
Default constructor is disabled.
Definition: angles.cc:164
void SetInclination(double inclination)
Setter for inclination angle.
Definition: angles.cc:203
double m_azimuth
the azimuth angle in radians
Definition: angles.h:223
double GetAzimuth() const
Getter for azimuth angle.
Definition: angles.cc:210
friend std::ostream & operator<<(std::ostream &os, const Angles &a)
Stream insertion operator.
Definition: angles.cc:129
void CheckIfValid() const
Check if Angle is valid or not Warns the user if the Angle is undefined (non-finite azimuth or inclin...
Definition: angles.cc:236
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double WrapToPi(double a)
Wrap angle in [-M_PI, M_PI)
Definition: angles.cc:115
double WrapTo180(double a)
Wrap angle in [-180, 180)
Definition: angles.cc:88
double WrapTo360(double a)
Wrap angle in [0, 360)
Definition: angles.cc:75
double DegreesToRadians(double degrees)
converts degrees to radians
Definition: angles.cc:39
double WrapTo2Pi(double a)
Wrap angle in [0, 2*M_PI)
Definition: angles.cc:102
double RadiansToDegrees(double radians)
converts radians to degrees
Definition: angles.cc:45