Предположим, есть две линии, l1
, l2
, и они могут быть пересекающимися или непересекающимися.Есть ли какой-нибудь элегантный способ найти угол между ними?Спасибо
import numpy as np
from shapely import LineString
l1 = [(0,0), (1,1)]
l2 = [(0.5, 1), (0.5, 2)]
ls1 = LineString(l1)
ls2 = LineString(l2)
angle = compute_angle(ls1, ls2)
# This is I want to avoid because I have very big dataset and performance will degrade
def compute_anlge(l1, l2):
#Extend line1 and line2 in both direction util they intersect
# Find intersection point
# Create new lines with the intersection point
# find angle and return