42 std::vector<double> radians;
43 radians.reserve(degrees.size());
44 for (
size_t i = 0; i < degrees.size(); i++)
54 std::vector<double> degrees;
55 degrees.reserve(radians.size());
56 for (
size_t i = 0; i < radians.size(); i++)
66 static constexpr int64_t INT_RANGE = 100000000000;
69 int64_t b(a / (360.0) * INT_RANGE);
76 else if (b >= INT_RANGE)
81 return b * (360.0) / INT_RANGE;
87 static constexpr int64_t INT_RANGE = 100000000000;
90 int64_t b(a / (360.0) * INT_RANGE);
93 if (b < -INT_RANGE / 2)
97 else if (b >= INT_RANGE / 2)
102 return b * (360.0) / INT_RANGE;
108 static constexpr int64_t INT_RANGE = 100000000000;
111 int64_t b(a / (2 * M_PI) * INT_RANGE);
118 else if (b >= INT_RANGE)
123 return b * (2 * M_PI) / INT_RANGE;
129 static constexpr int64_t INT_RANGE = 100000000000;
132 int64_t b(a / (2 * M_PI) * INT_RANGE);
135 if (b < -INT_RANGE / 2)
139 else if (b >= INT_RANGE / 2)
144 return b * (2 * M_PI) / INT_RANGE;
167 os <<
"(" << azim <<
", " << incl <<
") " << unit;
178 is.setstate(std::ios_base::failbit);
189 : m_azimuth(azimuth),
190 m_inclination(inclination)
196 : m_azimuth(
std::atan2(v.y, v.x)),
197 m_inclination(
std::acos(v.z / v.GetLength()))
200 if (v.x == 0.0 && v.y == 0.0 && v.z == 0.0)
261 "m_inclination=" <<
m_inclination <<
" not valid, should be in [0, pi] rad");
Class holding the azimuth and inclination angles of spherical coordinates.
void NormalizeAngles()
Normalize the angle azimuth angle range between in [-M_PI, M_PI) while checking if the angle is valid...
double m_inclination
the inclination angle in radians
double GetInclination() const
Getter for inclination angle.
static bool m_printDeg
flag for printing in radians or degrees units
void SetAzimuth(double azimuth)
Setter for azimuth angle.
Angles()
Default constructor is disabled.
void SetInclination(double inclination)
Setter for inclination angle.
double m_azimuth
the azimuth angle in radians
double GetAzimuth() const
Getter for azimuth angle.
void CheckIfValid() const
Check if Angle is valid or not Warns the user if the Angle is undefined (non-finite azimuth or inclin...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double WrapToPi(double a)
Wrap angle in [-M_PI, M_PI)
std::ostream & operator<<(std::ostream &os, const Angles &a)
double WrapTo180(double a)
Wrap angle in [-180, 180)
std::istream & operator>>(std::istream &is, Angles &a)
const double DEG_TO_RAD
Degrees to Radians conversion constant.
double WrapTo360(double a)
Wrap angle in [0, 360)
double DegreesToRadians(double degrees)
converts degrees to radians
double WrapTo2Pi(double a)
Wrap angle in [0, 2*M_PI)
double RadiansToDegrees(double radians)
converts radians to degrees
const double RAD_TO_DEG
Radians to Degrees conversion constant.