投影矩阵以在平面上投影一个点 [英] Projection matrix to project a point in a plane

查看:479
本文介绍了投影矩阵以在平面上投影一个点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何确定4x4 S 矩阵,以便P在XZ(Y = 0)平面上投影到Q中?

How to determinate the 4x4 S matrix so that the P gets projected into Q, on the XZ (Y=0) plane?

Q = S P

推荐答案

我将给出从点 L 到平面 E 的中心投影的一般解决方案(假设 L 中没有包含 L .

I will give the general solution for central projection from a point L to a plane E (assuming that L is not contained in E).

为方便起见,我将使用Octave/MATLAB表示法.

I will use Octave/MATLAB notation for convenience.

L 以齐次坐标给出

L=[lx ly lz 1]'

E 以Hessian范式(也是齐次坐标)给出

And E be given in Hessian normal form (also homogeneous coordinates)

E=[nx, ny, ,nz, d]'

其中[nx,ny,nz]是平面的法线,而d是其到原点的有符号距离.

where [nx, ny, nz] is the normal to the plane and d is its signed distance to the origin.

然后是矩阵 S ,该矩阵通过投影中心将任意点 P (也在同构坐标中)投影到平面 E > L

Then the matrix S which projects any point P (also in homogeneous coordinates) to the plane E through the center of projection L is

S=eye(4)*(L'*E)-L*E'

中心投影是

Q=S*P

作为Octave/MATLAB函数

% A matrix S describing central projection to a plane E
% L a point in homogeneous coordinates of projective 3-space
% E a plane in homogeneous coordinates of projective 3-space
% Requirement: scalar product of L and E is non-zero (i.e. L is not contained in E)
function S = central_projection_to_plane(L, E)
    S = [
     + L(2)*E(2) + L(3)*E(3) + L(4)*E(4), - L(1)*E(2)                         , - L(1)*E(3)                         , - L(1)*E(4)                        ;
     - L(2)*E(1)                        , + L(1)*E(1) + L(3)*E(3) + L(4)*E(4) , - L(2)*E(3)                         , - L(2)*E(4)                        ;
     - L(3)*E(1)                        , - L(3)*E(2)                         , + L(1)*E(1) + L(4)*E(4) + L(2)*E(2) , - L(3)*E(4)                        ;
     - L(4)*E(1)                        , - L(4)*E(2)                         , - L(4)*E(3)                         , + L(1)*E(1) + L(2)*E(2) + L(3)*E(3)
];
end % function

P.S.:要得出此结论,请注意,通过 L P 的行可以写为4x4普吕克矩阵

P.S.: To derive this, note that the line through L and P can be written as a 4x4 Plücker matrix

Rx=L*P'-P*L'.

Rx线和平面 E 的交点很简单

The intersection of the line Rx and the plane E is simply

Q=Rx*E
 =(L*P'-P*L')*E
 =(eye(4)*(L'*E)-L*E')*P
 =S*P

另请参见:https://en.wikipedia.org/wiki/Plücker_matrix

这篇关于投影矩阵以在平面上投影一个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆