Answers for "calculate angle between 3 points python"

0

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)
Posted by: Guest on August-10-2021

Code answers related to "calculate angle between 3 points python"

Python Answers by Framework

Browse Popular Code Answers by Language