docs: update math API docs
This commit is contained in:
@@ -1,22 +1,45 @@
|
||||
# Matrix4::TRS
|
||||
# Matrix4x4::TRS
|
||||
|
||||
```cpp
|
||||
static Matrix4 TRS(const Vector3& translation, const Quaternion& rotation, const Vector3& scale)
|
||||
static Matrix4x4 TRS(const Vector3& translation, const Quaternion& rotation, const Vector3& scale)
|
||||
```
|
||||
|
||||
创建完整的 TRS(平移、旋转、缩放)变换矩阵。
|
||||
创建组合变换矩阵。等价于先缩放、再旋转、最后平移的组合效果。
|
||||
|
||||
**参数:**
|
||||
- `translation` - 平移向量
|
||||
- `rotation` - 旋转四元数
|
||||
- `scale` - 缩放向量
|
||||
|
||||
**返回:** `Matrix4` - 组合变换矩阵
|
||||
**返回:** 组合变换矩阵 T * R * S
|
||||
|
||||
**复杂度:** O(1)
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(n²) - 涉及多次 4x4 矩阵运算
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Matrix4 transform = Matrix4::TRS(position, rotation, Vector3::One());
|
||||
#include "XCEngine/Math/Matrix4.h"
|
||||
#include "XCEngine/Math/Vector3.h"
|
||||
#include "XCEngine/Math/Quaternion.h"
|
||||
|
||||
using namespace XCEngine::Math;
|
||||
|
||||
Matrix4 transform = Matrix4::TRS(
|
||||
Vector3(1.0f, 2.0f, 3.0f),
|
||||
Quaternion::FromEuler(0.0f, 90.0f, 0.0f),
|
||||
Vector3(2.0f, 2.0f, 2.0f)
|
||||
);
|
||||
|
||||
Vector3 point(1.0f, 0.0f, 0.0f);
|
||||
Vector3 transformed = transform.MultiplyPoint(point);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Matrix4](matrix4.md) - 返回类总览
|
||||
- [Translation](translation.md) - 平移矩阵
|
||||
- [Rotation](rotation.md) - 旋转矩阵
|
||||
- [Scale](scale.md) - 缩放矩阵
|
||||
- [Decompose](decompose.md) - 分解矩阵
|
||||
Reference in New Issue
Block a user