Python Forum
finding angle between three points on a 2d graph
Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
finding angle between three points on a 2d graph
#4
here is what i have so far:
import math
p1x = 0
p1y = 5
p2x = 0
p2y = 0
p3x = 5
p3y = 0
angle1 = (math.atan2(p3y - p1y, p3x - p1x) - math.atan2(p2y - p1y, p2x - p1x))
print(angle1)
based on something i found online, but not sure if it is correct, also it just gives
0.785(irrational) and i want a 0-360 number.
edit: i changed it to deg with math.degrees,
but still doesn't work to my full intentions
and gives me 45 deg when its 90 deg
Reply


Messages In This Thread
RE: finding angle between three points on a 2d graph - by qrani - Nov-20-2018, 01:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  pylab, labeling points on a graph. Dasiey12 0 1,717 Apr-04-2021, 01:08 AM
Last Post: Dasiey12
  Adding graph points and formating project_science 4 2,443 Jan-24-2021, 05:02 PM
Last Post: project_science
  How to map 360 degree angle over 1024 counts breadcat248 3 2,558 May-17-2019, 07:13 AM
Last Post: breadcat248
  Converting Angle to X and Y Values: 90/180/270 deg qrani 1 2,791 Nov-21-2018, 06:41 PM
Last Post: woooee
  Angle kripso 12 34,513 Oct-30-2017, 11:33 PM
Last Post: kripso
  How to find the cosine of an angle sylas 6 5,274 May-25-2017, 04:29 PM
Last Post: sylas

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020