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 calcula
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).