4D to 3D projection

8.1k Views Asked by At

Im trying to calculate the position of 4D point in 3D world. I started with 2D and tried to extend it to the 3D and then to 4D. Firstly, I found out that its easy to calculate the projected position of 2D point on the line.

Whoops, there should be () in the first equation: x/(a+y)

Now I figured out that the same will apply in the 3D world if I split the P(X,Y,Z) to the P1(X,Z) and P2(Y,Z), calcualte their Q and then build a point of P'(Q1,Q2) (Assuming Im looking Z axis positive infinity from C(0,-a) point and rendering to the XY plane).

nx = (a*x)/(a+z);
ny = (a*y)/(a+z);

Then I thought its just as simple as adding next point P3, and came up with

nx = (a*x)/(a+z);
ny = (a*y)/(a+z);
nw = (a*w)/(a+z);

I felt it was weird, becouse W (new axis) actually affects only Z of the last point, and referring to the tesseract it should affect all dimensions...

This isn't working, so I'd like to ask if you can possibly provide some details of what Im doing wrong. Im pretty sure that its the "point splitting" problem, and the equation should be more complex. Please, don't attack me with matrixes and quaternions. I just want to have a simple static camera at (0,-1) looking at (0,0)...

Thanks for any help!

1

There are 1 best solutions below

4
On BEST ANSWER

Let's say you have a point ${\bf p} \in \mathbb{R}^4$ that you want to project on to a three-dimensional hyperplane that is sat inside $\mathbb{R}^4$. Let ${\bf q} \in \mathbb{R}^4$ be the point from which you project and assume that the plane has the equation $a_1x_1+a_2x_2+a_3x_3+a_4x_4=c$, where the $a_i$ and $c$ are fixed numbers.

You can parametrise the ray from ${\bf q}$ to ${\bf p}$ and beyond by ${\bf x} = (1-t){\bf q}+t{\bf p}$, where $t \ge 0$. When $t=0$ we're at the point of projection ${\bf q}$. When $t=1$, we're at the point to be projected ${\bf p}$. For all other $t \ge 0$ we're on the straight line starting at ${\bf q}$, passing through ${\bf p}$ and carrying on forever.

This line hits the plane when $x_i= (1-t)q_i+tp_i$ solve the equation $a_1x_1+a_2x_2+a_3x_3+a_4x_4=c$. All of the $p_i$ and $q_j$ will be number that you know, as will all of the $a_k$ and $c$. You will get a linear equation in $t$. Solve that equation to give, say $t=\tau$ then plug that back into the vector equation ${\bf x} = (1-t){\bf q}+t{\bf p}$.