0

I'm working on a mobile app and have two coordinates (LatLngA and LatLngB) which are on a straight distance of 100 meters from each other.

I also have the initial bearing from LatLngA to LatLngB.

I need to find out LatLngC in between these two coordinates at a given distance X.

I see that the first answer of this question might help: How to find a point between two points with given distance?. But I'm not sure how to find unit vectors in x and y direction.

As you might have figured, I'm not a mathematician, so I'm looking for a simplified answer that could be used in my code.

1 Answers1

1

If point $A$ and $B$ have coordinates $A=(x_A,y_A)$, $B=(x_B,y_B)$, and $d=\sqrt{(x_A-x_B)^2+(y_A-y_B)^2}$, then the coordinates of $C$ are $$C=\left(x_A+(x_B-x_A){x\over d},\ y_A+(y_B-y_A){x\over d}\right).$$

Intelligenti pauca
  • 50,470
  • 4
  • 42
  • 77