I think this is the correct interpretation of what you're doing:
You have a pinhole (?centroid?) located at $(x_p,y_p,z_p)$ and you are projecting onto a plane perpendicular to the $z$-direction. That plane located $f$ units (in the negative $z$-direction) from the pinhole.
Let's find the $(u,v)$ coordinates of an arbitrary point $(x_c,y_c,z_c)$.
First, find the line through $(x_c,y_c,z_c)$ and $(x_p,y_p,z_p)$. This line has direction vector ${\bf v} = \langle x_c-x_p, y_c-y_p, z_c-z_p\rangle$ and passes through the point $(x_p,y_p,z_p)$. We get that ${\bf \ell}(t) = \langle x_p,y_p,z_p \rangle + t\langle x_c-x_p, y_c-y_p, z_c-z_p\rangle$ parameterizes such a line.
Multiplying out: ${\bf \ell}(t) = \langle x_p+t(x_c-x_p),y_p+t(y_c-y_p),z_p+t(z_c-z_p)\rangle$. We want the point on this line which lies in the plane perpendicular to the $z$-direction and $f$ units away from $(x_p,y_p,z_p)$. In other words, the $z$-coordinate of our projected point should be $z_p - f$.
Therefore, we need $z_p+t(z_c-z_p)=z_p-f$ so that $t(z_c-z_p)=-f$ and so $t = \dfrac{-f}{z_c-z_p}$. Thus the $x=u$ and $y=v$ coordinates of that point are $u = x_p+\dfrac{-f}{z_c-z_p}(x_c-x_p)$ and $v = y_p+\dfrac{-f}{z_c-z_p}(y_c-y_p)$.
Your formulas come from the case when $(x_p,y_p,z_p)=(0,0,0)$ (i.e., the origin).
So to convert from the 3D-coordinates to the 2D-projected coordinates, you just need to compute:
$$(x_c,y_c,z_c) \mapsto \left( x_p+\dfrac{-f}{z_c-z_p}(x_c-x_p), y_p+\dfrac{-f}{z_c-z_p}(y_c-y_p)\right)$$
[which is necessarily undefined when $z_c=z_p$]
I'm not sure what else there is to be said without you further specifying what you're doing.
Best Answer
If it is a prismatic object you want then you can extrude or drag the shape in the third 3D space direction. Word,Excel and many softwares can readily show such images of blocks.
To formulate a surface if co-ordinates are given in parametric form $ x(t), y(t) $ forming any base contour, then add $ z = c u $, where $c$ is chosen for the depth you want.
$$ (x(t), y(t), c u ); $$
In general conversion of 2D projection to 3D as you ask is indeterminate. However, if two orthogonal views are given, then using certain rules softwares like Autodesk can create a 3D view that you can rotate in 3D with mouse.
For mathematical generation of a extruded or linearly swept surface:
Use two parameters $(t,u)$ one for reference plane and other for creating depth that would get you such a 3D extrusion/prism surface.