# finding point on line 1 unit next from start point

I have a line passing through points P1(x1,y1) and P2(x2,y2). Can I find next point on the same line thats 1 unit away from Point P1(x1,y1)? If yes how can I find? I just draw line at these points in reality it can be anywhere. Known Values

A(x1,y2)
B(x2,y2)
d = distance from A to C

Needs to find C(x,y)


The line is given by $P(t)=P_1+tv$, where $v$ is parallel to $P_2-P_1$. Taking $v$ to be of norm 1 allows you to take $P(1)$ as the point you seek. In other words, the point you seek is $$P_1+ \frac{P_2-P_1}{\|P_2-P_1\|}$$ More generally, the point at distance $d$ from $P_1$ is $$P_1+ d\frac{P_2-P_1}{\|P_2-P_1\|}$$

Explicitly, $$x= x_1 + \frac{d}{n}(x_2-x_1), \quad y= y_1 + \frac{d}{n}(y_2-y_1)$$ where $n = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$.

• not sure how to solve this. What is P2? I dont know P2,P1. I have x,y values of Points P1 and P2. Sorry I have very very basic level of understanding in mathematic. – coure2011 Jan 4 '12 at 12:44
• if A is (2.72, 5.24) and B is (-2.42, 1.54) and d is 1 how to get Cx and Cy? – coure2011 Jan 4 '12 at 12:45
• @coure2011, see my edited answer. – lhf Jan 4 '12 at 12:48

Find the distance between $B$ and $A$, call this ${BA}$.

Find the distance between $C$ and $B$ (it's ${BA}-d$), call this ${CB}$.

Let the coordinates of $C$ be $(c_1,c_1)$.

Now use similar triangles:

$${\color{darkblue}{y_1-y_2}\over {BA}}= {\color{darkgreen}{c_2-y_2}\over {CB}}$$

and

$${\color{maroon}{x_1-x_2}\over {BA}}= {\color{orange}{c_1-x_2} \over {CB}}.$$

Solve the above for $c_1$ and $c_2$. Triangles $\triangle ABa$ and $\triangle CBc$ are similar. That is, they have the same angles. Thus, corresponding ratios of side lengths are equal: $$\def\overline{} {\overline{BC}\over\overline{ Bc}}={\overline{BA}\over\overline{ Ba}},\quad {\overline{BC}\over\overline{ Cc}}={\overline{BA}\over\overline{ Aa}},\quad {\overline{Bc}\over \overline{Cc}}={\overline{Ba}\over\overline{ Aa}}.$$

This is the same as saying the slope of a line can be computed using two arbitrary points on the line.

Since we know $P_1=(x_1,y_1)$ and $P_2(x_2,y_2)$, we can find the equation of the line using two-point form, which is given by $$\tag{1} y-y_1=\frac{y_2-y_1}{x_2-x_1}(x-x_1).$$

Now if $P=(x,y)$ is a point on the line, then of course $(x,y)$ satisfies (\ref{1}). Moreover, if $P$ is 1 unit away from $P_1=(x_1,y_1)$, then the distance between $P$ and $P_1$ is given by $$\sqrt{(x-x_1)^2+(y-y_1)^2}=1.$$ Substitute $(1)$ into this, we get $$(x-x_1)^2+\left[\frac{y_2-y_1}{x_2-x_1}(x-x_1)\right]^2=1,$$ which is a quadratic equation in $x$. By solving it, you can find the $x$-coordinate of $P$. After finding $x$, you can find the $y$-coordinate of $P$ by using $(1)$ again.