Skip to content

Commit

Permalink
Added descentSpeedForPathAngle
Browse files Browse the repository at this point in the history
  • Loading branch information
albar965 committed Oct 22, 2021
1 parent ad9589a commit 2a5844e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/fs/perf/aircraftperf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ float AircraftPerf::getDescentRateFtPerNm(float headWind) const

float AircraftPerf::getClimbFlightPathAngle(float headWind) const
{
return static_cast<float>(ageo::toDegree(std::atan(ageo::feetToNm(getClimbRateFtPerNm(headWind)))));
return static_cast<float>(ageo::atanDeg(ageo::feetToNm(getClimbRateFtPerNm(headWind))));
}

float AircraftPerf::getDescentFlightPathAngle(float headWind) const
{
return static_cast<float>(ageo::toDegree(std::atan(ageo::feetToNm(getDescentRateFtPerNm(headWind)))));
return static_cast<float>(ageo::atanDeg(ageo::feetToNm(getDescentRateFtPerNm(headWind))));
}

bool AircraftPerf::isClimbValid() const
Expand Down
7 changes: 7 additions & 0 deletions src/geo/calculations.h
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,13 @@ inline TYPE atan2Deg(TYPE y, TYPE x)
return static_cast<TYPE>(atools::geo::toDegree(atan2(static_cast<double>(y), static_cast<double>(x))));
}

/* Get descent speed in feet/minute for groundspeed and vertical angle. Returns positive values. */
template<typename TYPE>
inline TYPE descentSpeedForPathAngle(TYPE groundspeedKts, TYPE vertAngleDeg)
{
return atools::geo::tanDeg(std::abs(vertAngleDeg)) * (atools::geo::nmToFeet(groundspeedKts) / 60.f);
}

} /* namespace geo */
} // namespace atools

Expand Down
2 changes: 1 addition & 1 deletion src/grib/windquery.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct WindAltLayer;
* Most query methods use the altitude from the Pos parameter.
*
* Downloaded/possible sets are:
* Altitide | Act. pressure | Pressure param | Downloaded | Used by X-Plane
* Altitude | Act. pressure | Pressure param | Downloaded | Used by X-Plane
* 10000 ft | 69.7 mb | 700 | * | XP
* 15000 ft | 57.2 mb | 550 | |
* 20000 ft | 46.6 mb | 450 | * |
Expand Down

0 comments on commit 2a5844e

Please sign in to comment.