calculate angle between 3 points python
from math import atan2, pi
def angle(A, B, C, /):
Ax, Ay = A[0]-B[0], A[1]-B[1]
Cx, Cy = C[0]-B[0], C[1]-B[1]
a = atan2(Ay, Ax)
c = atan2(Cy, Cx)
if a < 0: a += pi*2
if c < 0: c += pi*2
return (pi*2 + c - a) if a > c else (c - a)