4D to 3D perspective projection

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 12:05:46
  • 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).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!