How to find the 3D point from projection point?

167 Views Asked by At

I can calculate projection point on monitor of a 3D polygon using the following equation.

$x'=x/(1+z/d)\\y'=y/(1+z/d)$.
Where $(x,y,z)$ is the $3D$ points and $(x',y')$ is projection points on the monitor. And $d$ is distance between COP(center of projection) and PP(Projection plane/monitor).

Now, I have $3$ points of polygon $(x_1,y_1,z_1),(x_2,y_2,z_2),(x_3,y_3,z_3)$. Using the above equation I can find out $(x'_1,y'_1),(x'_2,y'_2),(x'_3,y'_3)$ on the monitor. After find out the projection point of corner of polygon I can find out all projection points of the polygon.

Now, my question is if I choose a point $(x_p,y_p)$ on the projected polygon that is on the PP, how can I find out the original $3D$ point of this point?

[I need this to implement polygon filling algorithm with shading in computer graphics.]

1

There are 1 best solutions below

0
On

Suppose the $3D$ co-ordinate of COP, projection point, and original object point are $(x_c,y_c,z_c)$, $(x',y',z')$, and $(x_3,y_3,z_3)$.

$\frac{x_c-x'}{x'-x_3}=\frac{y_c-y'}{y'-y_3}=\frac{z_c-z'}{z'-z_3}=k'=\frac{1}{k}$

So, $x_3=x'-k(x_c-x'),\\y_3=y'-k(y_c-y'),\\z_3=z'-k(z_c-z')$

Where $z'=0$ if the PP is on the origin.

To calculate value of k, we have to use the general equation of plane $Ax+By+Cz+d=0$. Substituting $(x,y,z)$ with $(x_3,y_3,z_3)$ we find

$A\{x'-k(x_c-x')\}+B\{y'-k(y_c-y')\}+C\{z'-k(z_c-z')\}+d=0$
$Ax'-Ak(x_c-x')+By'-Bk(y_c-y')+Cz'-Ck(z_c-z')+d=0$
$-k\{A(x_c-x')+Bk(y_c-y')+Ck(z_c-z')\}+Ax'+By'+Cz'+d=0$

$k=\frac{Ax'+By'+Cz'+d}{A(x_c-x')+Bk(y_c-y')+Ck(z_c-z')}$

To know the value of $A,B,C,d$ see this answer