docs: update math API docs
This commit is contained in:
@@ -1,20 +1,35 @@
|
||||
# Matrix4::Translation
|
||||
# Matrix4x4::Translation
|
||||
|
||||
```cpp
|
||||
static Matrix4 Translation(const Vector3& v)
|
||||
static Matrix4x4 Translation(const Vector3& v)
|
||||
```
|
||||
|
||||
创建平移矩阵。
|
||||
创建平移矩阵。生成的矩阵用于沿指定方向移动点或向量。
|
||||
|
||||
**参数:**
|
||||
- `v` - 平移向量
|
||||
- `v` - 平移向量 (x, y, z 方向上的平移量)
|
||||
|
||||
**返回:** `Matrix4` - 平移矩阵
|
||||
**返回:** 平移矩阵
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Matrix4 translation = Matrix4::Translation(Vector3(1.0f, 2.0f, 3.0f));
|
||||
#include "XCEngine/Math/Matrix4.h"
|
||||
#include "XCEngine/Math/Vector3.h"
|
||||
|
||||
using namespace XCEngine::Math;
|
||||
|
||||
Matrix4 translate = Matrix4::Translation(Vector3(5.0f, 3.0f, 2.0f));
|
||||
Vector3 point(1.0f, 1.0f, 1.0f);
|
||||
Vector3 moved = translate.MultiplyPoint(point);
|
||||
// moved = (6.0f, 4.0f, 3.0f)
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Matrix4](matrix4.md) - 返回类总览
|
||||
- [TRS](trs.md) - 组合变换矩阵
|
||||
Reference in New Issue
Block a user