s-d-a / DCS-ExportScripts

DCS World Export Scripts
GNU Lesser General Public License v3.0
114 stars 52 forks source link

UH-1H Get_Bearing function #25

Open fakirsu opened 2 years ago

fakirsu commented 2 years ago

Hello, I have the distinct impression that the mathematical formula provided in the UH-1H profile of DCS.ExportScript, namely math.atan2(lon2 - lon1, lat2 - lat1), is not correct.

The correct mathematical formula seems to me to be: θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ ) where φ1,λ1 is the start point, φ2,λ2 the end point (Δλ is the difference in longitude)

When I do tests with this new formula, I have almost no more discrepancy with the bearing determined with the rule of the F10 card.

The distance calculation formula, on the other hand, seems correct.

What do you think ?