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. More... | |
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. More... | |
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. More... | |
double | GetAzimuth () const |
Getter for azimuth angle. More... | |
double | GetInclination () const |
Getter for inclination angle. More... | |
void | SetAzimuth (double azimuth) |
Setter for azimuth angle. More... | |
void | SetInclination (double inclination) |
Setter for inclination angle. More... | |
Static Public Attributes | |
static bool | m_printDeg = false |
flag for printing in radians or degrees units More... | |
Private Member Functions | |
Angles () | |
Default constructor is disabled. More... | |
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]) More... | |
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. More... | |
Private Attributes | |
double | m_azimuth |
the azimuth angle in radians More... | |
double | m_inclination |
the inclination angle in radians More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Angles &a) |
Stream insertion operator. More... | |
std::istream & | operator>> (std::istream &is, Angles &a) |
Stream extraction operator. More... | |
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 |/
ns3::Angles::Angles | ( | double | azimuth, |
double | inclination | ||
) |
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 199 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 206 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 266 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 240 of file angles.cc.
References m_azimuth.
Referenced by IsotropicAntennaModelTestCase::BuildNameString(), CosineAntennaModelTestCase::BuildNameString(), ParabolicAntennaModelTestCase::BuildNameString(), DoBeamforming(), OneVectorConstructorTestCase::DoRun(), TwoVectorsConstructorTestCase::DoRun(), ns3::ThreeGppChannelModel::GenerateChannelParameters(), ns3::UniformPlanarArray::GetElementFieldPattern(), 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 246 of file angles.cc.
References m_inclination.
Referenced by IsotropicAntennaModelTestCase::BuildNameString(), CosineAntennaModelTestCase::BuildNameString(), ParabolicAntennaModelTestCase::BuildNameString(), DoBeamforming(), OneVectorConstructorTestCase::DoRun(), TwoVectorsConstructorTestCase::DoRun(), ns3::ThreeGppChannelModel::GenerateChannelParameters(), ns3::UniformPlanarArray::GetElementFieldPattern(), 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 252 of file angles.cc.
References CheckIfValid(), m_azimuth, and ns3::WrapToPi().
Referenced by Angles(), SetAzimuth(), and SetInclination().
void ns3::Angles::SetAzimuth | ( | double | azimuth | ) |
Setter for azimuth angle.
azimuth | angle in radians |
Definition at line 226 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 233 of file angles.cc.
References m_inclination, and NormalizeAngles().
|
friend |
|
friend |
|
private |
the azimuth angle in radians
Definition at line 223 of file angles.h.
Referenced by Angles(), CheckIfValid(), GetAzimuth(), NormalizeAngles(), and SetAzimuth().
|
private |
the inclination angle in radians
Definition at line 224 of file angles.h.
Referenced by Angles(), CheckIfValid(), GetInclination(), and SetInclination().
|
static |