📜  计算3点之间的角度python代码示例

📅  最后修改于: 2022-03-11 14:45:06.473000             🧑  作者: Mango

代码示例1
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)