Matrix4x4 矩阵api介绍

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.
两个矩阵相乘。
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值