# Get angle from 2 points

Show 40 post(s) from this thread on one page
Page 1 of 2 12 Last
• Aug 2nd 2012, 01:21 PM
mplus
Get angle from 2 points
Hi,

How can I get the angle from 2 xy coordinates?

Point 1 (2,1), Point 2 (4,5). What I want is the angle from/between point1 to point2.

Attachment 24408

Thanks.
• Aug 2nd 2012, 01:29 PM
Plato
Re: Get angle from 2 points
Quote:

Originally Posted by mplus
Hi,

How can I get the angle from 2 xy coordinates?

Point 1 (2,1), Point 2 (4,5). What I want is the angle from/between point1 to point2.

Attachment 24408

There is no angle between two points.
An angle is the union of two rays with common endpoints.
• Aug 2nd 2012, 01:29 PM
Amer
Re: Get angle from 2 points
you mean the angle which made from the line that pass from the two points with the x-axis (cute angle, < 90 )?? if that so
tan ( angle ) = slope
slope of that line is 4/2 = 2
so the angle will be arctan(2)
• Aug 2nd 2012, 03:51 PM
mplus
Re: Get angle from 2 points
Yes what Amer said is what I meat.

But atan(2) = 1.107. The answer I was looking is between 30-40degrees (pure by looking at it).

I hope it describes it better.
• Aug 2nd 2012, 03:59 PM
skeeter
Re: Get angle from 2 points
Quote:

Originally Posted by mplus
Yes what Amer said is what I meat.

But atan(2) = 1.107. The answer I was looking is between 30-40degrees (pure by looking at it).

I hope it describes it better.

atan(2) = 1.107 radians .. check the mode of your calculator and change it to degrees if you want degrees
• Aug 2nd 2012, 04:32 PM
mplus
Re: Get angle from 2 points
No its for a programming language.
• Aug 2nd 2012, 05:01 PM
Plato
Re: Get angle from 2 points
Quote:

Originally Posted by mplus
Yes what Amer said is what I meat.

But atan(2) = 1.107. The answer I was looking is between 30-40degrees (pure by looking at it).

Well there are still mathematical dinosaurs who still use degrees.
For those left behind you want $\frac{\arctan(2)\cdot 180^o}{\pi}=63.435^o.$
• Aug 2nd 2012, 06:54 PM
mplus
Re: Get angle from 2 points
Yes I can to that conclusion too of 63 degrees. But the answer doesn't look correct. The answer should be somewhere between 30-40 at the most.

So whats wrong?
• Aug 2nd 2012, 11:46 PM
Phoenix999
Re: Get angle from 2 points
If you slide the line over till it hits the y axis, it looks around 63 degrees to me.

I to am trying to create a function that can calculate degrees from a graph for the purpose of a script in Script-fu for GIMP. However, the problem is the slope of 90 degrees is y/0, which creates some difficulty when writing a function.

Any input is appreciated.

Thank you.
• Aug 3rd 2012, 02:09 AM
emakarov
Re: Get angle from 2 points
Quote:

Originally Posted by mplus
Yes I can to that conclusion too of 63 degrees. But the answer doesn't look correct. The answer should be somewhere between 30-40 at the most.

Please explain why you think so.
• Aug 3rd 2012, 05:41 AM
HallsofIvy
Re: Get angle from 2 points
The angle, as shown in your picture, is clearly larger than 40 degrees. Where did you get the condition that it must be "between 30-40 at the most"?
• Aug 3rd 2012, 06:56 AM
mplus
Re: Get angle from 2 points
I updated the image.

If you were to place point1 at 0,0 so in the center it definitely isn't over 45degrees.

Attachment 24410
• Aug 3rd 2012, 07:05 AM
emakarov
Re: Get angle from 2 points
Are you aware that, as customary in mathematics and as stated explicitly in post #3, the angles are measured between the line in question and the x-axis (the horizontal one)?
• Aug 3rd 2012, 07:57 AM
mplus
Re: Get angle from 2 points
Well I was hoping to get the degrees starting at the 0 degrees.

I can do 63-90 = 27degrees. But I was hoping to get a formula which starts at 0 degrees, the upper y axis.
• Aug 3rd 2012, 08:04 AM
emakarov
Re: Get angle from 2 points
You can either subtract the found angle from 90 or take the arctangent of Δx / Δy instead of Δy / Δx. Here Δx is the difference of the x-coordinates and similarly for y.
Show 40 post(s) from this thread on one page
Page 1 of 2 12 Last