x' = (d x) / (z+d)
y' = (d y) / (z+d)
where d is the distance from the viewer's eye at (0,0,-d)

If d=3 and we want to paint the point (2,4,5), we paint at:
x'=(d x) / (z+d) = (3*2)/(5+3)=6/8=3/4 and
y'=(d y) / (z+d) =(3*4)/(5+3)=12/8=3/2.
ie at the point (3/4, 3/2)