Update calculate_headings.py
Move function explanation def
This commit is contained in:
parent
841a78dc04
commit
ccc6855d07
|
@ -17,10 +17,10 @@ def calculate_cardinal(d):
|
||||||
card = dirs[ix % len(dirs)]
|
card = dirs[ix % len(dirs)]
|
||||||
return card
|
return card
|
||||||
def calculate_deg_change(new_heading, original_heading):
|
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:
|
if new_heading is None:
|
||||||
print("Track heading missing. No change")
|
print("Track heading missing. No change")
|
||||||
return 0
|
return 0
|
||||||
"""Calculates change between two headings, returns negative degree if change is left, positive if right"""
|
|
||||||
normal = abs(original_heading-new_heading)
|
normal = abs(original_heading-new_heading)
|
||||||
across_inital = 360 - abs(original_heading-new_heading)
|
across_inital = 360 - abs(original_heading-new_heading)
|
||||||
if across_inital < normal:
|
if across_inital < normal:
|
||||||
|
|
Loading…
Reference in New Issue