diff --git a/03-UnrealEngine/Math/四元数学习笔记.md b/03-UnrealEngine/Math/四元数学习笔记.md index b3d7e6d..a332e26 100644 --- a/03-UnrealEngine/Math/四元数学习笔记.md +++ b/03-UnrealEngine/Math/四元数学习笔记.md @@ -60,6 +60,23 @@ $$p \rightarrow q\cdot p \cdot q^-1$$ ## 四元数规范化 $$x^2 + y^2 + z^2 =1$$ + +## 四元数求反 +```c++ +inline QQuaternion QQuaternion::inverted() const +{ + // Need some extra precision if the length is very small. + double len = double(wp) * double(wp) + + double(xp) * double(xp) + + double(yp) * double(yp) + + double(zp) * double(zp); + if (!qFuzzyIsNull(len)) + return QQuaternion(float(double(wp) / len), float(double(-xp) / len), + float(double(-yp) / len), float(double(-zp) / len)); + return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f); +} +``` + # FBX 四元数旋转顺序 xyz 可以使用