# Coordinates of point on a line defined by two other points with a known distance from one of them

I have two points in 3D space; let's call them $A=(a_x, a_y, a_z)$ and $B=(b_x, b_y, b_z).$

Now, I need to place a third point, let's call it $C=(c_x, c_y, c_z)$, which lies on the line between $A$ and $B$ and is some known distance from $A$.

Is there some easy way I can get the $c_x, c_y, c_z$ coordinates knowing the distance from $C$ to $A$?

I would easily be able to do this in 2D, but I never worked with 3D space and I can't seem to figure it out.

Thanks.

It's quite similar to 2D space. Consider a vector $v = B-A$ which you can imagine is the direction from $A$ to $B$. Hence for any point $C$ between $A$ and $B$ (inclusive of $A$ and $B$).

$$C = A + tv$$

where $t = 0$ implies $C = A$ and $t = 1$ implies $C = B$ and $t \in (0,1)$ are all the points in between (one of which is the desired $C$). As you can see, this representation is independent of the dimension of your space.

So, what's the value of $t$? Well, let the known distance from $A$ to $C$ be $d_{AC}$. Now, the distance between $A$ and $B$ or $d_{AB}$ is the magnitude of $v$ or $|v|$ which is nothing but

$$d_{AB} = |v| = \sqrt{(a_x-b_x)^2+(a_y-b_y)^2+(a_z-b_z)^2}$$

(You can see that this formula for the Euclidean distance between two points is similar in 2D as well)

Therefore, $t = \large \frac{d_{AC}}{d_{AB}}$ and substituting $t$ and $v$ in the previous formula for $C$, we have:

$$C = A + \frac{d_{AC}}{\sqrt{(a_x-b_x)^2+(a_y-b_y)^2+(a_z-b_z)^2}}(B-A)$$

• @Jacob: I suspect that the question intended $x$, $y$, and $z$ to be subscripts. – André Nicolas Jun 20 '11 at 18:50
• @Jacob: I hope you don't mind; I added the subscripts, centered your formulas...feel free to edit or roll-back to suit your taste. – amWhy Jun 20 '11 at 19:11
• @amWhy: Thanks for changing the OP as well! – Jacob Jun 20 '11 at 19:18
• @Jacob: Not a problem - I realized you were trying to "speak in the same language" as the post, for consistency, so I adjusted both... – amWhy Jun 20 '11 at 19:33