Implement line_heading()

This commit is contained in:
XANTRONIX 2025-03-21 16:29:23 -04:00
parent e1adfd0059
commit afad8898c7

View file

@ -1,4 +1,5 @@
import re
import math
import shapely
def load_poly_from_file(path: str) -> shapely.Polygon:
@ -16,3 +17,9 @@ def load_poly_from_file(path: str) -> shapely.Polygon:
points.append((float(lon), float(lat)))
return shapely.Polygon(points)
def line_heading(p1: shapely.Point, p2: shapely.Point) -> float:
dx = p2.x - p1.x
dy = p2.y - p1.y
return math.atan2(dy, dx)