# 3D Linear equation problem

I have two points in 3D space:

point $A = (1,2,3)$

point $B = (4,7,6)$

I want to find a third point between the two, where $z = 5$

So, point $C = (x,y,5)$

How can I calculate $x$ and $y$ for point $C$?

Thanks.

-
When you formalize 'between', you'll be able to answer that for yourself. –  Alexei Averchenko Jul 28 '11 at 13:31

The points on the line segment between $(a,b,c)$ and $(p,q,r)$ have coordinates $$(sa+(1-s)p,\: sb+(1-s)q, \: sc+(1-s)r)\quad\quad\text{(Equation 1)},$$ where $0 \le s \le 1$.
In our case we have $c=3$ and $r=6$. So $$3s+6(1-s)=5.$$ Solve for $s$. We obtain $s=1/3$. Now the other coordinates are easy to find from Equation $1$.
We get $$x=(1/3)(1)+(2/3)(4)=9/3=3,$$ $$y=(1/3)(2)+(2/3)(7)=16/3.$$
Equation $1$ says that the coordinates of any point between two given points is a "weighted average" of the given coordinates. In our particular case, the number $5$ is twice as far from $3$ as it is from $6$. So the point we are looking for is $2/3$ of the way from $(1,2,3)$ to $(4,7,6)$. Apply the $1/3$, $2/3$ weighting to the other two coordinates.