Class holding the azimuth and inclination angles of spherical coordinates. More...
#include "angles.h"
Public Member Functions | |
Angles (double azimuth, double inclination) | |
This constructor allows to specify azimuth and inclination. | |
Angles (Vector v) | |
This constructor will initialize azimuth and inclination by converting the given 3D vector from cartesian coordinates to spherical coordinates Note: azimuth and inclination angles for a zero-length vector are not defined and are thus initialized to NAN. | |
Angles (Vector v, Vector o) | |
This constructor initializes an Angles instance with the angles of the spherical coordinates of point v respect to point o. | |
double | GetAzimuth () const |
Getter for azimuth angle. | |
double | GetInclination () const |
Getter for inclination angle. | |
void | SetAzimuth (double azimuth) |
Setter for azimuth angle. | |
void | SetInclination (double inclination) |
Setter for inclination angle. | |
Static Public Attributes | |
static bool | m_printDeg = false |
flag for printing in radians or degrees units | |
Private Member Functions | |
Angles () | |
Default constructor is disabled. | |
void | CheckIfValid () const |
Check if Angle is valid or not Warns the user if the Angle is undefined (non-finite azimuth or inclination), throws an assert if the inclination angle is invalid (not in [0, M_PI]) | |
void | NormalizeAngles () |
Normalize the angle azimuth angle range between in [-M_PI, M_PI) while checking if the angle is valid, i.e., finite and within the bounds. | |
Private Attributes | |
double | m_azimuth |
the azimuth angle in radians | |
double | m_inclination |
the inclination angle in radians | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Angles &a) |
Stream insertion operator. | |
std::istream & | operator>> (std::istream &is, Angles &a) |
Stream extraction operator. | |
Class holding the azimuth and inclination angles of spherical coordinates.
The notation is the one used in "Antenna Theory - Analysis and Design", C.A. Balanis, Wiley, 2nd Ed., section 2.2 "Radiation pattern". This notation corresponds to the standard spherical coordinates, with azimuth measured counterclockwise in the x-y plane off the x-axis, and inclination measured off the z-axis. Azimuth is consistently normalized to be in [-M_PI, M_PI).
^ z | |_ inclination | \ | /| |/ | y +--------> / \| /___/ x / azimuth |/
This constructor allows to specify azimuth and inclination.
Inclination must be in [0, M_PI], while azimuth is automatically normalized in [-M_PI, M_PI)
azimuth | the azimuth angle in radians |
inclination | the inclination angle in radians |
Definition at line 188 of file angles.cc.
References NormalizeAngles().
ns3::Angles::Angles | ( | Vector | v | ) |
This constructor will initialize azimuth and inclination by converting the given 3D vector from cartesian coordinates to spherical coordinates Note: azimuth and inclination angles for a zero-length vector are not defined and are thus initialized to NAN.
v | the 3D vector in cartesian coordinates |
Definition at line 195 of file angles.cc.
References m_azimuth, m_inclination, and NormalizeAngles().
ns3::Angles::Angles | ( | Vector | v, |
Vector | o ) |
This constructor initializes an Angles instance with the angles of the spherical coordinates of point v respect to point o.
v | the point (in cartesian coordinates) for which the angles are determined |
o | the origin (in cartesian coordinates) of the spherical coordinate system |
|
private |
|
private |
Check if Angle is valid or not Warns the user if the Angle is undefined (non-finite azimuth or inclination), throws an assert if the inclination angle is invalid (not in [0, M_PI])
Definition at line 256 of file angles.cc.
References m_azimuth, m_inclination, NS_ASSERT_MSG, and NS_LOG_WARN.
Referenced by NormalizeAngles().
double ns3::Angles::GetAzimuth | ( | ) | const |
Getter for azimuth angle.
Definition at line 230 of file angles.cc.
References m_azimuth.
Referenced by CosineAntennaModelTestCase::BuildNameString(), IsotropicAntennaModelTestCase::BuildNameString(), ParabolicAntennaModelTestCase::BuildNameString(), DoBeamforming(), DoBeamforming(), OneVectorConstructorTestCase::DoRun(), TwoVectorsConstructorTestCase::DoRun(), ns3::ThreeGppChannelModel::GenerateChannelParameters(), ns3::UniformPlanarArray::GetElementFieldPattern(), ns3::CircularApertureAntennaModel::GetGainDb(), ns3::CosineAntennaModel::GetGainDb(), ns3::ParabolicAntennaModel::GetGainDb(), ns3::ThreeGppAntennaModel::GetGainDb(), ns3::ThreeGppChannelModel::GetNewChannel(), and ns3::PhasedArrayModel::GetSteeringVector().
double ns3::Angles::GetInclination | ( | ) | const |
Getter for inclination angle.
Definition at line 236 of file angles.cc.
References m_inclination.
Referenced by CosineAntennaModelTestCase::BuildNameString(), IsotropicAntennaModelTestCase::BuildNameString(), ParabolicAntennaModelTestCase::BuildNameString(), DoBeamforming(), DoBeamforming(), OneVectorConstructorTestCase::DoRun(), TwoVectorsConstructorTestCase::DoRun(), ns3::ThreeGppChannelModel::GenerateChannelParameters(), ns3::UniformPlanarArray::GetElementFieldPattern(), ns3::CircularApertureAntennaModel::GetGainDb(), ns3::CosineAntennaModel::GetGainDb(), ns3::ThreeGppAntennaModel::GetGainDb(), ns3::ThreeGppChannelModel::GetNewChannel(), and ns3::PhasedArrayModel::GetSteeringVector().
|
private |
Normalize the angle azimuth angle range between in [-M_PI, M_PI) while checking if the angle is valid, i.e., finite and within the bounds.
Note: while an arbitrary value for the azimuth angle is valid and can be wrapped in [-M_PI, M_PI), an inclination angle outside the [0, M_PI] range can be ambiguous and is thus not valid.
Definition at line 242 of file angles.cc.
References CheckIfValid(), m_azimuth, and ns3::WrapToPi().
Referenced by Angles(), Angles(), SetAzimuth(), and SetInclination().
void ns3::Angles::SetAzimuth | ( | double | azimuth | ) |
Setter for azimuth angle.
azimuth | angle in radians |
Definition at line 216 of file angles.cc.
References m_azimuth, and NormalizeAngles().
Referenced by ns3::CosineAntennaModel::GetGainDb().
void ns3::Angles::SetInclination | ( | double | inclination | ) |
Setter for inclination angle.
inclination | angle in radians. Must be in [0, M_PI] |
Definition at line 223 of file angles.cc.
References m_inclination, and NormalizeAngles().
|
friend |
|
friend |
|
private |
the azimuth angle in radians
Definition at line 212 of file angles.h.
Referenced by Angles(), CheckIfValid(), GetAzimuth(), NormalizeAngles(), and SetAzimuth().
|
private |
the inclination angle in radians
Definition at line 213 of file angles.h.
Referenced by Angles(), CheckIfValid(), GetInclination(), and SetInclination().
|
static |