0
$\begingroup$

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.

$\endgroup$
1
$\begingroup$

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).$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.