Given two points A and B and a distance d, I'm trying to calculate a point C between A and B and at distance d from point A.
I was thinking on using Thales theoreme, but is there a better/simpler solution?
Cheers!
Given two points A and B and a distance d, I'm trying to calculate a point C between A and B and at distance d from point A.
I was thinking on using Thales theoreme, but is there a better/simpler solution?
Cheers!
We can parametrize the line connecting $A$ and $B$ by
$$P(t)=A+t(B-A)$$
with $t\in \mathbb R$ such that
then indicating with
we have that
$$C=P(t_d)=A+\frac d {|B-A|}(B-A)$$
that is in components
and
$$|B-A|=\sqrt{(lat_B-lat_A)^2+(lng_B-lng_A)^2}$$