33 #ifndef EMANEPHYPOSITIONUTILS_HEADER_ 34 #define EMANEPHYPOSITIONUTILS_HEADER_ 48 std::tuple<double,double,double>
60 PositionNEU mutableRemoteAntennaPositionNEU{remoteAntennaPositionNEU};
66 mutableRemoteAntennaPositionNEU.rotate(localOrientation.getYawRadians() - remoteOrientation.getYawRadians(),
67 localOrientation.getPitchRadians() - remoteOrientation.getPitchRadians(),
68 localOrientation.getRollRadians() - remoteOrientation.getRollRadians());
73 remoteNEU.adjust(-localAntennaPositionNEU.
getNorthMeters() + mutableRemoteAntennaPositionNEU.getNorthMeters(),
74 -localAntennaPositionNEU.
getEastMeters() + mutableRemoteAntennaPositionNEU.getEastMeters(),
75 -localAntennaPositionNEU.
getUpMeters() + mutableRemoteAntennaPositionNEU.getUpMeters());
78 double dDistanceMeters{
NORMALIZE_VECTOR(remoteNEU.getNorthMeters(), remoteNEU.getEastMeters(), remoteNEU.getUpMeters())};
81 double dElevationDegrees{asin(remoteNEU.getUpMeters() / dDistanceMeters) * (180.0 / M_PI)};
84 double dAzimuthDegrees{};
86 if(remoteNEU.getNorthMeters() == 0.0)
88 if( remoteNEU.getEastMeters() > 0.0)
90 dAzimuthDegrees = 90.0;
94 dAzimuthDegrees = 270.0;
99 if(remoteNEU.getEastMeters() == 0.0)
101 if(remoteNEU.getNorthMeters() > 0.0)
103 dAzimuthDegrees = 0.0;
107 dAzimuthDegrees = 180.0;
112 dAzimuthDegrees = atan(remoteNEU.getEastMeters() / remoteNEU.getNorthMeters()) * (180.0 / M_PIl);
115 if(remoteNEU.getNorthMeters() < 0.0)
117 dAzimuthDegrees += 180.0;
120 if((remoteNEU.getNorthMeters() > 0.0) && ( remoteNEU.getEastMeters() < 0.0))
122 dAzimuthDegrees += 360.0;
126 return std::make_tuple(dAzimuthDegrees, dElevationDegrees, dDistanceMeters);
129 inline std::pair<double,double>
136 double dAzimuth {dAzReference - dAzPointing};
139 double dElevation = {dElReference - dElPointing};
150 return {dAzimuth, dElevation};
155 const double dHeightMeters2,
156 const double dDistanceMeters)
158 const double dDH1{3570.0 * sqrt(dHeightMeters1 < 0.0 ? 0.0 : dHeightMeters1)};
160 const double dDH2{3570.0 * sqrt(dHeightMeters2 < 0.0 ? 0.0 : dHeightMeters2)};
162 return (dDH1 + dDH2) > dDistanceMeters;
167 #endif // EMANEPHYPOSITIONUTILS_HEADER_ std::tuple< double, double, double > calculateDirection(const PositionOrientationVelocity &localLocationInfo, const PositionNEU &localAntennaPositionNEU, const PositionOrientationVelocity &remoteLocationInfo, const PositionNEU &remoteAntennaPositionNEU)
std::pair< const Orientation &, bool > getAdjustedOrientation() const
double getNorthMeters() const
std::pair< double, double > calculateLookupAngles(double dAzReference, double dAzPointing, double dElReference, double dElPointing)
void AI_TO_BE_DEGREES(double &val, const double A, const double B)
void NEG_90_TO_POS_90_DEGREES(double &val)
double NORMALIZE_VECTOR(const double x, const double y, const double z)
double getUpMeters() const
bool checkHorizon(const double dHeightMeters1, const double dHeightMeters2, const double dDistanceMeters)
PositionNEU getPositionNEU(const PositionOrientationVelocity &other) const
double getEastMeters() const