3D projection in 2D using the light-source concept

194 Views Asked by At

To achieve 3D projection in 2D I use the light-source concept ( that I got to know in this forum it self ) , so basically I determine a light source with 3D coordinates $(0 ,0 , h)$ and so the 2D coordinates of a point $(x ,y ,z)$ are $$\left(x\ \frac{h}{h + z} ,y\ \frac{h}{h + z}\right) .$$ The question is:

Can I change the light source coordinates from $(0, 0, h)$ to $(h_1, h_2, h_3)$, and if it is possible, what will be the 2D coordinates resulting.

1

There are 1 best solutions below

0
On

Sorry for the delay, now I found time to answer. As I told you in the comments make a translation of the axes before and after the projection: let $P\equiv(x, y, z)$, $L\equiv(h_1,h_2,h_3)$ and $Q$ be the projected point in 3D space.

First we translate to have only the third coordinate of the light source not null: $P'\equiv(x-h_1, y-h_2, z)$ and $L\equiv(0,0,h_3)$.

Now we can use your formula on $P',L'$: $ Q'\equiv ((x-h_1) * {h _3 \over h_3 + z},(y -h_2)* {h _3\over h_3+ z}, 0)$.

Finally we translate $Q'$ in the opposite direction of the first translation: $ Q\equiv ((x-h_1) * {h _3 \over h_3 + z}+h_1,(y -h_2)* {h _3\over h_3+ z}+h_2, 0)$.

Discard the third coordinate and you have your position in 2D space.