# Find a point on a known line, a set distance from a point on the line as well as off the line

I have three points. $P_1(x_1,y_1)$ and $P_2(x_2,y_2)$ and $P_3(x_3,y_3)$ and I am looking for $P_4(x_4,y_4)$.

$P_1$ and $P_2$ are on the same line as $P_4$. I have a known distance along the line which I will call $D_1$. $P_4$ is a distance of $D_1 * T$ away from $P_1$ along this line.

$P_3$ is on the same line as $P_4$, but not the same line as $P_1$ and $P_2$. I have a known distance along this line which is $D_2$. $P_4$ is a distance of $D_2 * T$ away from $P_3$ along this unknown line.

$T$ is an unknown multiplier that is the same for both $D_1$ and $D_2$ to reach $P_4$.

$D_1$ is also known as a direction vector where $D_2$ is only known as a distance.

If someone is able to help me find $P_4$, it would be greatly appreciated.

Clarification

P1, P2 and P4 are all on a straight line, as in if you draw a line from P1 to P4, it will also pass through P2.

P3 and P4 also form a straight line where P4 is D2 * T away from P4.

D1 is a distance which is also known as a direction vector because it is along the straight line which includes P1, P2 and P4. As in P2 - P1 is a direction vector D1 and Pythagorean theorem lets us find the distance of said vector. I was just trying to give available information for whichever would be most useful.

Example

This is what I have tried, although it is basic and only works when the distance from P3 to P4 is equal to the distance from P3 to P1. Also of note, D1 is used in its vector form.

P4 = P1 + D1 * |P1-P3| / D2

And this works perfectly when |P1-P3| = |P4-P3| but that only covers a very small range of possible scenarios.

Picture!

Thanks for looking!

• What did you try? – user99914 Feb 23 '15 at 6:06
• Without a diagram this will likely remain unread by many members here, in particular because there are some rather unclear things: how come $\;D_1\;$ is both a distance and a vector, for example? – Timbuc Feb 23 '15 at 6:26
• A point does not uniquely define a line. I have no idea what you mean to say when you say "$P_1$ and $P_2$ are on the same line as $P_4$", or "$P_3$ is on the same line as $P_4$". The first I interpret to possibly mean that "$P_1, P_2$, and $P_4$ are collinear." The second statement I don't know how to interpret. – Willie Wong Feb 23 '15 at 9:19

I am happy that there is actually a unique solution.

The way I am imagining this is that we have two objects initially --- the vector $\mathbf{P_1P_2}$ and the circle with centre $P_3$ and radius $d_1$ and they are both sitting in the plane, $\Pi$.

Now what happens is we continuously enlarge both the vector and circle in a linear way. Depending on the situation we can start at an enlargement factor of $T=1$ and enlarge or start at $T=1$ and shrink.

So you have a vector $\mathbf{v}(T)$ and a circle $\mathcal{C}(T)$.

Now there are a few different cases that need to be teased out... I am going to assume that $d_2<|\mathbf{d_1}|$.

The 'top' of vector $\mathbf{v}(t)$ sits at $\mathbf{P_1}+T\,\mathbf{P_1P_2}$. At some point in their simultaneous enlargement the 'top' of the vector will lie on the circle and the distance from this to the centre will equal the radius of the circle $Td_2$:

$$\sqrt{(Tx_2+(1-T)x_1-x_3)^2+(Ty_2+(1-T)y_1-y_3)^2}=Td_2.$$

Squaring both sides gives a quadratic in $T$.

There will be two solutions $T_1$ and $T_2$. One of them, say $T_1$, will be negative and will come from \begin{align} \text{distance from }\mathbf{v}(T_1)\text{ to }P_3\text{ is }T_1d_2, \end{align} which has no solutions but we will get an extraneous solution when we square the right hand side.