返回介绍

Matrix4x4 4x4矩阵

发布于 2019-12-18 15:38:00 字数 5701 浏览 1818 评论 0 收藏 0

Namespace: UnityEngine

Description 描述

A standard 4×4 transformation matrix.

一个标准的4×4变换矩阵。

A transformation matrix can perform arbitrary linear 3D transformations (i.e. translation, rotation, scale, shear etc.) and perspective transformations using homogenous coordinates. You rarely use matrices in scripts; most often using Vector3s, Quaternions and functionality of Transform class is more straightforward. Plain matrices are used in special cases like setting up nonstandard camera projection.

一个变换矩阵可以表达任意的线性3D变换(例如平移,旋转,缩放,切变等)并且使用齐次坐标系进行投影变换。我们基本上不会在脚本中使用矩阵;通常都直接使用三维向量、四元数以及Transform对象的函数。在特殊的场合例如设置一个非标准化的摄像机投影时才使用纯粹的矩阵。

Consult any graphics textbook for in depth explanation of transformation matrices.

参考任意一本图形学对于变换矩阵的深入解释。

In Unity, Matrix4x4 is used by several Transform, Camera, Material and GL functions.

在Unity中,Matrix4x4对象被很多Transform,Camera,Matierial和Gl中的函数使用。

Matrices in unity are column major. Data is accessed as: row + (column*4). Matrices can be indexed like 2D arrays but in an expression like mat[a, b], a refers to the row index, while b refers to the column index (note that this is the opposite way round to Cartesian coordinates).

Unity中的矩阵使用的是列优先。数据通过行+(列*4)的方式获取。矩阵可以被索引为类似二维数组的形式,但是要以mat[a,b]这样的表达式。其中a代表行号,b代表列号(注意这正好与笛卡尔坐标系相反)。

Static Variables 静态变量

identityReturns the identity matrix (Read Only).
返回单位矩阵(只读)。
zeroReturns a matrix with all elements set to zero (Read Only).
返回所有元素设置为零的矩阵(只读)。

Variables 变量

determinantThe determinant of the matrix.
矩阵的决定因素。
inverseThe inverse of this matrix (Read Only).
这个矩阵的逆矩阵(只读)。
isIdentityIs this the identity matrix?
这个矩阵是单位矩阵吗?
this[int,int]Access element at [row, column].
获取[行,列]所对应的元素。
transposeReturns the transpose of this matrix (Read Only).
返回这个矩阵的转置矩阵(只读)。

Functions 方法

GetColumnGet a column of the matrix.
获取这个矩阵的一列。
GetRowReturns a row of the matrix.
返回这个矩阵的一行。
MultiplyPointTransforms a position by this matrix (generic)
使用该矩阵对一个坐标(点)进行变换(普通)
MultiplyPoint3x4Transforms a position by this matrix (fast).
使用该矩阵对一个坐标(点)进行变换(快速)
MultiplyVectorTransforms a direction by this matrix.
使用该矩阵对一个方向(按方法名理解应该是向量吧,向量包含方向和大小,译者注)进行变换
SetColumnSets a column of the matrix.
给这个矩阵的一列赋值。
SetRowSets a row of the matrix.
给这个矩阵的以行赋值。
SetTRSSets this matrix to a translation, rotation and scaling matrix.
把这个矩阵变为平移、旋转和缩放矩阵。
ToStringReturns a nicely formatted string for this matrix.
返回一个该矩阵的漂亮的格式化字符串。

Static Functions 静态方法

OrthoCreates an orthogonal projection matrix.
创建一个正交投影矩阵。
PerspectiveCreates a perspective projection matrix.
创建一个透视投影矩阵。
ScaleCreates a scaling matrix.
创建一个缩放矩阵。
TRSCreates a translation, rotation and scaling matrix.
创建一个平移、旋转和缩放矩阵。

Operators 运算符重载

operator *Multiplies two matrices.
两个矩阵相乘。

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文