|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
54 std::vector<double> radians;
55 radians.reserve (degrees.size ());
56 for (
size_t i = 0; i < degrees.size (); i++)
68 std::vector<double> degrees;
69 degrees.reserve (radians.size ());
70 for (
size_t i = 0; i < radians.size (); i++)
95 a = fmod (a + 180, 360);
102 NS_ASSERT_MSG (-180 <= a && a < 180,
"Invalid wrap, a=" << a);
110 a = fmod (a, 2 * M_PI);
116 NS_ASSERT_MSG (0 <= a && a < 2 * M_PI,
"Invalid wrap, a=" << a);
124 a = fmod (a + M_PI, 2 * M_PI);
131 NS_ASSERT_MSG (-M_PI <= a && a < M_PI,
"Invalid wrap, a=" << a);
155 os <<
"(" << azim <<
", " << incl <<
") " << unit;
166 is.setstate (std::ios_base::failbit);
178 : m_azimuth (azimuth),
179 m_inclination (inclination)
186 : m_azimuth (std::atan2 (v.y, v.
x)),
187 m_inclination (std::acos (v.z / v.GetLength ()))
190 if (v.x == 0.0 && v.y == 0.0 && v.z == 0.0)
256 "m_inclination=" <<
m_inclination <<
" not valid, should be in [0, pi] rad");
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
double GetInclination(void) const
Getter for inclination angle.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetInclination(double inclination)
Setter for inclination angle.
void NormalizeAngles(void)
Normalize the angle azimuth angle range between in [-M_PI, M_PI) while checking if the angle is valid...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
double WrapTo360(double a)
Wrap angle in [0, 360)
double WrapTo2Pi(double a)
Wrap angle in [0, 2*M_PI)
double m_azimuth
the azimuth angle in radians
Angles()
Default constructor is disabled.
double m_inclination
the inclination angle in radians
double WrapTo180(double a)
Wrap angle in [-180, 180)
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
double WrapToPi(double a)
Wrap angle in [-M_PI, M_PI)
void CheckIfValid(void) const
Check if Angle is valid or not Warns the user if the Angle is undefined (non-finite azimuth or inclin...
double RadiansToDegrees(double radians)
converts radians to degrees
Class holding the azimuth and inclination angles of spherical coordinates.
void SetAzimuth(double azimuth)
Setter for azimuth angle.
static bool m_printDeg
flag for printing in radians or degrees units
double GetAzimuth(void) const
Getter for azimuth angle.
std::ostream & operator<<(std::ostream &os, const Angles &a)
double DegreesToRadians(double degrees)
converts degrees to radians
std::istream & operator>>(std::istream &is, Angles &a)