summaryrefslogtreecommitdiffstats
path: root/src/common/quaternion.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-10-10 05:56:20 +0200
committerbunnei <bunneidev@gmail.com>2017-10-10 05:56:20 +0200
commitb1d5db1cf60344b6b081c9d03cb6ccc3264326cd (patch)
treefde377c4ba3c0f92c032e6f5ec8627aae37270ef /src/common/quaternion.h
parentloader: Various improvements for NSO/NRO loaders. (diff)
parentMerge pull request #2996 from MerryMage/split-travis (diff)
downloadyuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar
yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.gz
yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.bz2
yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.lz
yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.xz
yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.tar.zst
yuzu-b1d5db1cf60344b6b081c9d03cb6ccc3264326cd.zip
Diffstat (limited to 'src/common/quaternion.h')
-rw-r--r--src/common/quaternion.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/quaternion.h b/src/common/quaternion.h
index 84ac82ed3..77f626bcb 100644
--- a/src/common/quaternion.h
+++ b/src/common/quaternion.h
@@ -30,6 +30,11 @@ public:
return {xyz * other.w + other.xyz * w + Cross(xyz, other.xyz),
w * other.w - Dot(xyz, other.xyz)};
}
+
+ Quaternion<T> Normalized() const {
+ T length = std::sqrt(xyz.Length2() + w * w);
+ return {xyz / length, w / length};
+ }
};
template <typename T>