3

I am attempting to find the angle between the 2 points (50.573,-210.265) and (117.833,-80.550).

Is my calculation correct because a program is giving me a different answer? It says the angle is 27'24'27.27 DMS

dx = x2 - x1;
dy = y2 - y1;
angle = Atan2(dy,dx) * 180 / PI;
angle = 62.59242

My result is 62.59242 degrees but the program says its 27'24'27.27 DMS. Which is correct?

Also if the points were 3d would that affect the angle? Or does the z axis not impact on the horizontal angle?

sazr
  • 195
  • 2
    One thing that should hit you right between the eyes is that the sum of these two numbers is eactly $90^\circ$. ${}\qquad{}$ – Michael Hardy May 17 '13 at 01:02
  • And yet, "For any real number (e.g., floating point) arguments $x$ and $y$ not both equal to zero, $atan2(y, x)$* is the angle in radians between the positive x-axis of a plane and the point given by the coordinates $(x, y)$ on it. The angle is positive for counter-clockwise angles (upper half-plane, $y > 0$ ), and negative for clockwise angles (lower half-plane, $y < 0$ )."* – Benjamin R Jan 28 '16 at 04:55

1 Answers1

6

I agree with your calculation. It appears they are defining it with the arguments switched. The fact that you answer is $90-$theirs supports this. Note that there is no angle between two points. What you have is the angle between the line through those points and the $x$ axis.

Ross Millikan
  • 374,822
  • 1
    Hi Ross, atan2 usually takes $(y,x)$ as the input: https://en.wikipedia.org/wiki/Atan2 – in fact, I've never seen a standard library function in a C-style language (as the op used) that doesn't. Your deduction is logical, but do you think this answer is specific to the unnamed program that returns DMS rather than in general? – Benjamin R Jan 28 '16 at 04:50
  • 1
    @BenjaminR: I think you are right. I agree with OP getting about 62.6 degrees. I have updated. – Ross Millikan Jan 28 '16 at 05:01