# Getting the third point from two points on one line

My question is the following

how can i get the x3,y3 point from x1,y1 and x2,y2 points?

the x3,y3 point distance from x1,y1 is 300.

-

## migrated from stackoverflow.comFeb 18 '11 at 18:23

This question came from our site for professional and enthusiast programmers.

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

-