🧮 Matrix
由旋转和原点构建的 4x4 变换矩阵,可用于几何和位置计算。主要在内部使用。
🎒 示例
-- Builds a matrix rotated 90 degrees in Yaw, placed at (100, 0, 0)
local matrix = Matrix(Rotator(0, 90, 0), Vector(100, 0, 0))
-- Rotates a direction by the matrix rotation (the origin is not applied)
local rotated_direction = matrix:TransformVector(Vector(50, 0, 0))
🛠 Constructors
Default Constructor
No description provided
local my_matrix = Matrix(rotation, origin)
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Rotator | rotation | Required parameter | 矩阵的旋转 |
| Vector | origin | Required parameter | 矩阵的原点 |
🦠 Functions
| Returns | Name | Description | |
|---|---|---|---|
| Vector | TransformVector | 按此矩阵的旋转来旋转向量(不应用原点) | |
| Matrix | GetTransposed | 返回一个转置后的新矩阵(维基百科) |
Optimal
TransformVector
按此矩阵的旋转来旋转向量(不应用原点)
local ret = my_matrix:TransformVector(vector)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | vector | Required parameter | 要进行变换的向量 |
Returns
| Type | Description |
|---|---|
| Vector | 新向量 |
Optimal
GetTransposed
返回一个转置后的新矩阵(维基百科)
local ret = my_matrix:GetTransposed()
Returns
| Type | Description |
|---|---|
| Matrix | 转置后的矩阵 |
