docs: 重构 API 文档结构并修正源码准确性
- 重组文档目录结构: 每个模块的概述页移动到模块子目录 - 重命名 index.md 为 main.md - 修正所有模块文档中的错误: - math: FromEuler→FromEulerAngles, TransformDirection 包含缩放, Box 是 OBB, Color::ToRGBA 格式 - containers: 新增 operator==/!= 文档, 补充 std::hash DJB 算法细节 - core: 修复 types 链接错误 - debug: LogLevelToString 返回大写, timestamp 是秒, Profiler 空实现标注, Windows API vs ANSI - memory: 修复头文件路径, malloc vs operator new, 新增方法文档 - resources: 修复 Shader/Texture 链接错误 - threading: TaskSystem::Wait 空实现标注, ReadWriteLock 重入描述, LambdaTask 链接 - 验证: fix_links.py 确认 0 个断裂引用
This commit is contained in:
56
docs/api/math/quaternion/quaternion.md
Normal file
56
docs/api/math/quaternion/quaternion.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# Quaternion
|
||||
|
||||
四元数结构体,用于表示 3D 旋转,避免欧拉角的万向锁问题。
|
||||
|
||||
**头文件:** `#include <XCEngine/Math/Quaternion.h>`
|
||||
|
||||
**命名空间:** `XCEngine::Math`
|
||||
|
||||
## 结构体定义
|
||||
|
||||
```cpp
|
||||
struct Quaternion {
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
float z = 0.0f;
|
||||
float w = 1.0f;
|
||||
};
|
||||
```
|
||||
|
||||
## 静态工厂方法
|
||||
|
||||
| 方法 | 返回值 | 描述 |
|
||||
|------|--------|------|
|
||||
| [Identity()](identity.md) | `Quaternion` | 返回 (0, 0, 0, 1),恒等旋转 |
|
||||
| [FromAxisAngle(axis, radians)](fromaxisangle.md) | `Quaternion` | 从轴角创建 |
|
||||
| [FromEulerAngles(pitch, yaw, roll)](fromeulerangles.md) | `Quaternion` | 从欧拉角创建(弧度) |
|
||||
| [FromEulerAngles(euler)](fromeulerangles.md) | `Quaternion` | 从 Vector3 欧拉角创建 |
|
||||
| [FromRotationMatrix(matrix)](fromrotationmatrix.md) | `Quaternion` | 从旋转矩阵创建 |
|
||||
| [Slerp(a, b, t)](slerp.md) | `Quaternion` | 球面线性插值 |
|
||||
| [LookRotation(forward, up)](lookrotation.md) | `Quaternion` | 看向方向 |
|
||||
|
||||
## 实例方法
|
||||
|
||||
| 方法 | 返回值 | 描述 |
|
||||
|------|--------|------|
|
||||
| [ToEulerAngles()](toeulerangles.md) | `Vector3` | 转换为欧拉角(弧度) |
|
||||
| [ToMatrix4x4()](tomatrix4x4.md) | `Matrix4` | 转换为 4x4 旋转矩阵 |
|
||||
| [Inverse()](inverse.md) | `Quaternion` | 共轭/逆四元数 |
|
||||
| [Dot(other)](dot.md) | `float` | 点积 |
|
||||
| [Magnitude()](magnitude.md) | `float` | 模长 |
|
||||
| [Normalized()](normalized.md) | `Quaternion` | 归一化 |
|
||||
| [Normalize(q)](../vector2/normalize.md) | `Quaternion` | 归一化(静态) |
|
||||
|
||||
## 运算符
|
||||
|
||||
| 运算符 | 描述 |
|
||||
|--------|------|
|
||||
| `operator*(Quaternion, Quaternion)` | 组合旋转 |
|
||||
|
||||
## 与 Vector3 的乘法
|
||||
|
||||
[Vector3 * Quaternion](quaternion-multiply.md) - 用四元数旋转向量
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Math 模块总览](../math.md) - 返回 Math 模块总览
|
||||
Reference in New Issue
Block a user