Fixed broken references: - texture-import-settings: Fix 16 files referencing wrong overview filename - math/rectint: Fix 9 method links (rectint-* → get*, contains, intersects) - rhi/opengl/device: Fix 8 cross-references (opengl-* → */**) - resources/mesh: Fix meshsection and vertexattribute links - rhi/d3d12/sampler: Fix RHISampler reference path - math/vector3: Fix projectonplane → project-on-plane - rhi/opengl/command-list: Remove broken ClearFlag enum ref - rhi/opengl/device: Create 2 new method docs (MakeContextCurrent, GetNativeContext) - rhi/device: Fix device-info types reference All 0 broken references remaining.
39 lines
856 B
Markdown
39 lines
856 B
Markdown
# Matrix4x4::Inverse
|
|
|
|
```cpp
|
|
Matrix4x4 Inverse() const
|
|
```
|
|
|
|
返回矩阵的逆矩阵。如果矩阵的行列式接近零(不可逆),则返回单位矩阵。
|
|
|
|
**参数:** (无)
|
|
|
|
**返回:** 逆矩阵;如果矩阵不可逆则返回单位矩阵
|
|
|
|
**线程安全:** ✅
|
|
|
|
**复杂度:** O(n³),对于 4x4 矩阵固定为 64 次基本运算
|
|
|
|
**示例:**
|
|
|
|
```cpp
|
|
#include "XCEngine/Core/Math/Matrix4.h"
|
|
|
|
using namespace XCEngine::Math;
|
|
|
|
Matrix4 transform = Matrix4::TRS(
|
|
Vector3(1.0f, 2.0f, 3.0f),
|
|
Quaternion::FromEuler(0.0f, 45.0f, 0.0f),
|
|
Vector3(2.0f, 2.0f, 2.0f)
|
|
);
|
|
|
|
Matrix4 inv = transform.Inverse();
|
|
Matrix4 identity = transform * inv;
|
|
// identity 接近单位矩阵
|
|
```
|
|
|
|
## 相关文档
|
|
|
|
- [Matrix4](matrix4.md) - 返回类总览
|
|
- [Determinant](determinant.md) - 计算行列式
|
|
- [Transpose](transpose.md) - 矩阵转置 |