A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::Angles Class Reference

Class holding the azimuth and inclination angles of spherical coordinates. More...

#include "angles.h"

+ Collaboration diagram for ns3::Angles:

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.
 

Detailed Description

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
 |/

Definition at line 106 of file angles.h.

Constructor & Destructor Documentation

◆ Angles() [1/4]

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)

Parameters
azimuththe azimuth angle in radians
inclinationthe inclination angle in radians

Definition at line 188 of file angles.cc.

References NormalizeAngles().

+ Here is the call graph for this function:

◆ Angles() [2/4]

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.

Parameters
vthe 3D vector in cartesian coordinates

Definition at line 195 of file angles.cc.

References m_azimuth, m_inclination, and NormalizeAngles().

+ Here is the call graph for this function:

◆ Angles() [3/4]

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.

Parameters
vthe point (in cartesian coordinates) for which the angles are determined
othe origin (in cartesian coordinates) of the spherical coordinate system

Definition at line 210 of file angles.cc.

◆ Angles() [4/4]

ns3::Angles::Angles ( )
private

Default constructor is disabled.

Definition at line 183 of file angles.cc.

Member Function Documentation

◆ CheckIfValid()

void ns3::Angles::CheckIfValid ( ) const
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().

+ Here is the caller graph for this function:

◆ GetAzimuth()

◆ GetInclination()

◆ NormalizeAngles()

void ns3::Angles::NormalizeAngles ( )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetAzimuth()

void ns3::Angles::SetAzimuth ( double azimuth)

Setter for azimuth angle.

Parameters
azimuthangle in radians

Definition at line 216 of file angles.cc.

References m_azimuth, and NormalizeAngles().

Referenced by ns3::CosineAntennaModel::GetGainDb().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetInclination()

void ns3::Angles::SetInclination ( double inclination)

Setter for inclination angle.

Parameters
inclinationangle in radians. Must be in [0, M_PI]

Definition at line 223 of file angles.cc.

References m_inclination, and NormalizeAngles().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Angles & a )
friend

Stream insertion operator.

Parameters
[in]osThe reference to the output stream.
[in]aThe angle.
Returns
The reference to the output stream.

Definition at line 147 of file angles.cc.

◆ operator>>

std::istream & operator>> ( std::istream & is,
Angles & a )
friend

Stream extraction operator.

Parameters
[in]isThe reference to the input stream.
[out]aThe angle.
Returns
The reference to the input stream.

Definition at line 172 of file angles.cc.

Member Data Documentation

◆ m_azimuth

double ns3::Angles::m_azimuth
private

the azimuth angle in radians

Definition at line 212 of file angles.h.

Referenced by Angles(), CheckIfValid(), GetAzimuth(), NormalizeAngles(), and SetAzimuth().

◆ m_inclination

double ns3::Angles::m_inclination
private

the inclination angle in radians

Definition at line 213 of file angles.h.

Referenced by Angles(), CheckIfValid(), GetInclination(), and SetInclination().

◆ m_printDeg

bool ns3::Angles::m_printDeg = false
static

flag for printing in radians or degrees units

Definition at line 186 of file angles.h.


The documentation for this class was generated from the following files: