My question is the following
How can I get point $(x3, y3)$ from points $(x1, y1)$ and $(x2, y2)$ ?
The distance of point $(x3, y3)$ from $(x1, y1)$ is $300$.
migrated from stackoverflow.com Feb 18 '11 at 18:23
This question came from our site for professional and enthusiast programmers.
The square of distance between
Now you can find
and the distance "d", in the case with the value of 300 units
you can define a vector (namely "u") pointing from P1 to P2, using vector subtraction:
(in the way that P2 = P1 + u)
then, you can normalize "u" making it unit norm, we can name that vector "v"
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:
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).