Find $z$ of a point in a plane in 3D space Say for example, I have 4 points which I know the coordinates to, how can I find a fifth point that lies somewhere within them?
E.g, if $A(0,0,a)$, $B(1,0,b)$, $C(1,1,c)$ and $D(0,1,d)$ lie in a square, how can I find the point $P$ that lies at $P(0.6,0.35,p)$?
I've tried using proportion to work out how far along a particular side, and then how far into the square it is, but I'm always getting something wrong somewhere.
Here's an example of what I mean : 
If I know the 4 points on the edge, how can I find any point inside?
(That is 3D, it just doesnt look like it)
 A: [edit]The basic idea is this: On the line of real numbers, to get from, for example, $a=2$ to $b=5$, one needs to go $b-a=3$. If one goes only halfway, one ends up at $a+(b-a)\cdot\frac{1}{2}=3.5$. To get to $4$, one needs to go two thirds of the way, as $4=a+\frac{2}{3}\cdot(b-a).
These consideration you can apply independently for each dimension in space: To get from point $A$'s x-coordinate to point $B$'s x-coordinate, how far do I need to go? If I go instead only to $P$'s x-coordinate, which fraction of the way is this? 
But when you actually go from $A$ towards $B$ until your x-coordinate equals $P$'s, the y-coordinate will probably not be right. However, with the right combination of also "going" towards another point (that, importantly, is not on the $A$-$B$-line), one can get the combination right, which is what I outlined below.
[/edit]
Take three points in space, say $A(x_a,y_a,z_a),B(x_b,y_b,z_b),D(x_d,y_d,z_d)$.
Then $\vec{AB} = (x_b-x_a,y_b-y_a,z_b-z_a)$, $\vec{AD}$ analoguously.
Now, if you start at a, go in the direction of B, but maybe not all the way, say only $0\leq s\leq 1$, where do you end up? Or if you go from A to D, but only $0\leq t \leq 1$? And if you go first towards B, then parallel to $AD$? You always end up inside the parallelogram that is defined by the points A, B and D. And the coordinates of the point are $A + s\cdot\vec{AB}+t\cdot\vec{AD}$.
Or written differently:
$x_a(1-s-t) + sx_b+tx_d = x_p$
$y_a(1-s-t) + sy_b+ty_d = y_p$
$z_a(1-s-t) + sz_b+tz_d = z_p$
Given $x_p$ and $y_p$, you can solve the first two equations for $s$ and $t$ and then find $z_p$ with the third. Even better, with arbitrary real $s$ and $t$ you can test whether any other given point is in fact on the same plane as $A$, $B$ and $D$, i.e. whether they actually form a quadrilateral.
