2

I want to calculate the angular distance between two points, with respect to a third point (i.e., the number of angular degrees by which bearings to each of these points differ, from the third point).

Desired angular distance between two points is marked with a question mark

In other words, I need an angle between two vectors with a single origin, but in my dataset I only have the x,y coordinates for the points.

I have tried the atan2 function, but it calculates the angle with reference to the x axis, which is different from what I need. I would be surprised if there was no ready function that takes x,y point coordinates as input and returns the angular distance but I can't find a suitable one.

Poul Kruijt
  • 69,713
  • 12
  • 145
  • 149
Kuba Krukar
  • 163
  • 1
  • 9

1 Answers1

1

Well assume (o1,o2) = (-1,1), (a1,a2) = (3,2), (b1,b2) = (-5,5)

Then angle = atan2(b1-o1,b2-o2) - atan2(a1-o1,a2-o2)

jpaul
  • 309
  • 1
  • 5
  • I think your argument order for atan2 is backward. The opposite side length is the first argument, followed by the adjacent side length. This looks like atan2(y, x). – jspencer Dec 04 '20 at 07:21