4D to 3D perspective projection

3k 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 answers

0
AudioBubble On
  • in 2D (x,y) a projection on y=0 means intersection of line with line:

    x'/a = x/(a+y)
    
  • in 3D (x,y,z) a projection on z=0 means intersection of line with plane:

    for y=0: x'/a = x/(a+z)
    for x=0: y'/a = y/(a+z)
    
  • in 4D (x,y,z,w) a projection onto w=0 means intersection of line with hyperplane:

    for y=0, z=0: x'/a = x/(a+w)
    for x=0, z=0: y'/a = y/(a+w)
    for x=0, y=0: z'/a = z/(a+w)
    
  • ...and so on

Alternatively one could calculate the intersection of a line and a hyperplane using the parameter form, where a line is described by:

[px,py,pz,pw] = [p0x,p0y,p0z,p0w] + t * [p1x,p1y,p1z,p1w]

where the parameter t is any number

A hyperplane is described by:

[hx,hy,hz,hw] = [h0x,h0y,h0z,h0w] + a * [h1x,h1y,h1z,h1w] + b * [h2x,h2y,h2z,h2w] + c * [h3x,h3y,h3z,h3w]

Now the intersection point can be found by solving:

[px,py,pz,pw] = [hx,hy,hz,hw]

or more explicit:

[p0x,p0y,p0z,p0w] + t * [p1x,p1y,p1z,p1w] = [h0x,h0y,h0z,h0w] + a * [h1x,h1y,h1z,h1w] + b * [h2x,h2y,h2z,h2w] + c * [h3x,h3y,h3z,h3w]

There are 4 equations (one for each dimension x,y,z,w) and 4 unknowns (a,b,c,t) which can be solved unless the line is parallel to the hyperplane.

The thoughts above are subject to analytical geometry in 4D (where the w component represents an own separate dimension) and they should not be mixed up with homogeneous coordinates (where the w component is used to integrate the translation/projection into 4D matrices and is discarded near the end of graphics pipeline by the perspective divide).