1from math import atan2, pi
2
3def angle(A, B, C, /):
4 Ax, Ay = A[0]-B[0], A[1]-B[1]
5 Cx, Cy = C[0]-B[0], C[1]-B[1]
6 a = atan2(Ay, Ax)
7 c = atan2(Cy, Cx)
8 if a < 0: a += pi*2
9 if c < 0: c += pi*2
10 return (pi*2 + c - a) if a > c else (c - a)
11