Update calculate_headings.py

Move function explanation def
This commit is contained in:
Jack Sweeney 2023-05-12 14:34:00 -04:00 committed by GitHub
parent 841a78dc04
commit ccc6855d07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -17,10 +17,10 @@ def calculate_cardinal(d):
card = dirs[ix % len(dirs)]
return card
def calculate_deg_change(new_heading, original_heading):
"""Calculates change between two headings, returns negative degree if change is left, positive if right"""
if new_heading is None:
print("Track heading missing. No change")
return 0
"""Calculates change between two headings, returns negative degree if change is left, positive if right"""
normal = abs(original_heading-new_heading)
across_inital = 360 - abs(original_heading-new_heading)
if across_inital < normal: