From 7884f20ea79b40e0d3a04587d69ff8fee7332a98 Mon Sep 17 00:00:00 2001 From: sebcrozet Date: Sat, 22 Sep 2018 15:39:21 +0200 Subject: [PATCH] Add quaternion dot product. --- src/geometry/quaternion.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index 375c6b57..eafb0de6 100644 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -202,6 +202,12 @@ impl Quaternion { self.coords.norm_squared() } + /// The dot product of two quaternions. + #[inline] + pub fn dot(&self, rhs: &Self) -> N { + self.coords.dot(&rhs.coords) + } + /// The polar decomposition of this quaternion. /// /// Returns, from left to right: the quaternion norm, the half rotation angle, the rotation