How to transform N-D coordinates into 2D coordinates using perspective projection

600 Views Asked by At

Suppose we have a vector in N dimentions: $\vec{v}=(v_1,v_2,v_3,...,v_N)$ assuming our focal point for the projection is at $(0,0,0,...,0)$. How would we project this N-D vector into a 2D vector? I tried simplifying things and started to try to project a 4D vector into 3D and then use that projection and project it into 2D. The 4D vector $$v_{4D}=(x,y,z,w)$$ We can imagine the cross-section between $w$ and the coordinates that live in 3D space. Assuming we want the image to be mapped onto a hyperplane that is $n_w$ away from the focal point in the $w$ direction we can see that there is 2 similar triangles to which we can relate: $$\frac{v'_{3D}}{n_w}=\frac{v_{3D}}{w}$$ where $$v_{3D} = (x,y,z)$$ and $v'_{3D}$ is the projected coordinate on the hyperplane. We can find $v'_{3D}$ with $$v'_{3D}=\frac{n_w}{w}v_{3D}$$ Now that we have got our new coordinates we can project this into 2d using a similar procedure: $$v''_{2D}=\frac{n_z}{z'}v'_{2D}$$ However, remember that $z' = \frac{n_w}{w}z$ and $v'_{2D} = \frac{n_w}{w}v_{2D}$ $$v''_{2D}=\frac{n_z w}{zn_w}\frac{n_w}{w}v_{2D}$$ $$v''_{2D}=\frac{n_z}{z}v_{2D}$$ This is equivalent to an orthographic projection from 4d to 3d, and has no information about the w component. What did I do wrong with the projection and how can I generalize it to higher dimensions?

If there is a general formula for projection of $N-2$ dimentions to 2D, if you can, leave it in a form of a matrix that acts on $v$

Many Thanks Josh