Skip to content

Instantly share code, notes, and snippets.

@ManivannanMurugavel
Created March 25, 2019 13:46
Show Gist options
  • Save ManivannanMurugavel/96e02cfd8875f6b94ea48e4c2741df1e to your computer and use it in GitHub Desktop.
Save ManivannanMurugavel/96e02cfd8875f6b94ea48e4c2741df1e to your computer and use it in GitHub Desktop.

Revisions

  1. ManivannanMurugavel created this gist Mar 25, 2019.
    7 changes: 7 additions & 0 deletions angle.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    import math

    def getAngle(a, b, c):
    ang = math.degrees(math.atan2(c[1]-b[1], c[0]-b[0]) - math.atan2(a[1]-b[1], a[0]-b[0]))
    return ang + 360 if ang < 0 else ang

    print(getAngle((5, 0), (0, 0), (0, 5)))