4x4矩阵如何在3d图形中工作? [英] How does 4x4 matrix work in 3d graphic?

查看:60
本文介绍了4x4矩阵如何在3d图形中工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习3D图形,偶然发现了矩阵,我对此并不完全了解.我有一个3D对象,具有拓扑结构,坐标系统中的点和ECS(对象的4x4矩阵). ECS是:

I am learning about 3d graphics and have stumbled upon matrixes, which I don't fully understand. I have a 3d object, with topology, points in coordinate system and ECS (4x4 matrix of the object). ECS is:

-1.1247455413666E-32 , 1.83690953073357E-16, 1                    , -95  , 
 1                   , 6.12303176911189E-17, 0                    , 604  , 
-6.12303176911189E-17, 1                   , -1.83690953073357E-16, 200.5, 
 0                   , 0                   , 0                    , 1    , 

用逗号分隔的每一行是什么意思?这些是翻译载体吗?

What does each line separated with comma mean ? Are these translation vectors?

推荐答案

矩阵定义线性变换向量空间之间.所有线性变换都将域的原点映射到范围的原点.因此3x3矩阵无法对3D向量执行平移,因为使用线性映射无法将一个空间中的原点映射到另一空间中的原点.

Matrices define linear transformations between vector spaces. All linear transformations map the origin of the domain to the origin of the range. Therefore 3x3 matrices cannot perform translation on 3D vectors since the origin in one space cannot be mapped to anything but the origin on another using linear maps.

为克服此问题,我们可以通过使用额外的维度来伪造系统以执行翻译,其中所有向量在最后一个向量分量中都为1.这些4D向量将永远不在原点(最后一个成分中为1),因此不需要始终映射到原点.通过使用此方法,我们可以构建一个4x4矩阵来执行翻译,如下所示:

To overcome this problem, we can fake the system into performing translations through the use of an extra dimension where all vectors will have a 1 in the last vector component. These 4D vectors will never be at the origin (having 1 in the last component) and so are not required to always map to the origin. Through the use of this we can construct a 4x4 matrix to perform translation as in:

| 1  0  0  Tx|   | x |   | x + Tx |
| 0  1  0  Ty|   | y |   | y + Ty |
| 0  0  1  Tz| x | z | = | z + Tz |
| 0  0  0   1|   | 1 |   |   1    |

出于渲染目的,将最后一个位置的1删除.

For rendering purposes, the 1 in the last position is dropped.

这篇关于4x4矩阵如何在3d图形中工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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