My question is the following
How can I get point $(x_3, y_3)$ from points $(x_1, y_1)$ and $(x_2, y_2)$ ?
The distance of point $(x_3, y_3)$ from $(x_1, y_1)$ is $300$.
My question is the following
How can I get point $(x_3, y_3)$ from points $(x_1, y_1)$ and $(x_2, y_2)$ ?
The distance of point $(x_3, y_3)$ from $(x_1, y_1)$ is $300$.
Assume: $dx = x2 - x1$ $dy = y2 - y1$
Then, $x3 = x1 + dx*k$ $y3 = y1 + dy*k$
The square of distance between $p1$ and $p3$ is:
$(dx^2 + dy^2)*k^2 = 300^2$
Now you can find $k$ and then $x3$ and $y3$
defining:
P1 (x1,y1)
and
P2 (x2,y2)
and the distance "d", in the case with the value of 300 units
d = 300
you can define a vector (namely "u") pointing from P1 to P2, using vector subtraction:
u = P2 - P1
(in the way that P2 = P1 + u)
then, you can normalize "u" making it unit norm, we can name that vector "v"
v(ux/norm(u),uy/norm(u))
with
norm(u) = (ux^2+uy^2)^0.5
to obtain the third point (namely P3), you need just to sum a vector with the direction from P1 to P2 with the norm equal to the distance (in case 300 units), in our notation:
P3 = P1 + v * d
Thanks to the illustration, we now that the direction is from P1 to P2. But remember, that only given the distance, are two solutions: the above and with -v (300 units from P1 in the direction from P2 to P1).
That solution is valid for a euclidean space with any number of dimensions (changes only the number of components to normalize and the number of elements to calculate the norm).