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

查看:37
本文介绍了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天全站免登陆