For a line in 3D space, you can know that for each P on the line with endpoints A and B and length L, it holds that ||P-A|| + ||P-B|| = L
My question is: is there a similar expression for points on an arbitrary rectangle in 3D space? You can't add up the distances to the corners, I checked that.
If the rectangle $R$ (or convex quadrilateral) has corners $A,B,C,D$, then any point $p$ inside $R$ satisfies $$ p = \alpha A + \beta B + \gamma C + \delta D $$ where $\alpha , \beta , \gamma , \delta \in [0,1]$ and $$ \alpha + \beta + \gamma + \delta = 1 $$ See Wikipedia's article on convex combination.