Files
XCEngine/docs/api/math/transform/transform.md

40 lines
1.1 KiB
Markdown
Raw Normal View History

# Transform
3D 变换结构体,包含位置、旋转和缩放,用于层次化变换。
**头文件:** `#include <XCEngine/Math/Transform.h>`
**命名空间:** `XCEngine::Math`
## Space 枚举
```cpp
enum class Space { Self, World };
```
## 结构体定义
```cpp
struct Transform {
Vector3 position = Vector3::Zero();
Quaternion rotation = Quaternion::Identity();
Vector3 scale = Vector3::One();
};
```
## 实例方法
| 方法 | 返回值 | 描述 |
|------|--------|------|
| [ToMatrix()](tomatrix.md) | `Matrix4` | 转换为 4x4 变换矩阵 |
| [Inverse()](inverse.md) | `Transform` | 逆变换 |
| `operator*(Transform, Transform)` | `Transform` | 组合变换 |
| [TransformPoint(point)](transformpoint.md) | `Vector3` | 变换点(带平移) |
| [TransformDirection(direction)](transformdirection.md) | `Vector3` | 变换方向(包含旋转和缩放) |
| [InverseTransformPoint(point)](inversetransformpoint.md) | `Vector3` | 逆变换点 |
| [InverseTransformDirection(direction)](inversetransformdirection.md) | `Vector3` | 逆变换方向 |
## 相关文档
- [Math 模块总览](../math.md) - 返回 Math 模块总览