My question is the following

enter image description here

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$

  • $\begingroup$ It gives me wrong answer $\endgroup$
    – Sami
    May 26 '14 at 12:50
  • $\begingroup$ @Sami Can you give an example? $\endgroup$ Jun 9 '14 at 3:27
  • $\begingroup$ Sorry its right. It was only my programming language problem. It tired it in javascript. I later came to know that there i had to use Math.pow(x,2) instead of x^2 $\endgroup$
    – Sami
    Jun 9 '14 at 8:43


P1 (x1,y1)


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"



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


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.