TITLE: How do I find a point a given distance from another point along a line?
QUESTION [11 upvotes]: I have $(x_1, y_1), (x_2, y_2)$.
How do I find the point that's $d$ distance away from $(x_1, y_1)$ on a straight line to $(x_2, y_2)$?
I know I can get the length of the line with Pythagoras. I know if I drew a circle I could use the radius as distance and the point would be where the line and the circle intersect.
Could someone briefly explain each step to me please?
I don't understand Finding a point along a line a certain distance away from another point!

REPLY [6 votes]: Consider a circle with radius $d$ and center $(x_1, y_1)$. This is the equation:
$$ (x - x_1)^2 + (y - y_1)^2 = d^2 $$
Let $m$ be the slope of the line from $(x_1, y_1)$ to $(x_2, y_2)$. ($m = \dfrac{y_2 - y_1}{x_2 - x_1}$). Our line must satisfy the equation:
$$ y - y_1 = m(x - x_1) $$
$$ y = m(x - x_1) + y_1 $$
We want to find when these two will intersect, so substituting:
$$ (x - x_1)^2 + (m(x - x_1) + y_1 - y_1)^2 = d^2 $$
$$ (x - x_1)^2 + m^2(x - x_1)^2 = d^2 $$
$$ (1 + m^2)(x - x_1)^2 = d^2 $$
$$ (x-x_1)^2 = \frac{d^2}{1+m^2} $$
$$ x - x_1 = \pm \sqrt\frac{d^2}{1+m^2} $$
$$ x = x_1 \pm \sqrt\frac{d^2}{1+m^2} $$