From 3ed1452188192c5f9116a81d5147ea9f503459ff Mon Sep 17 00:00:00 2001 From: Chinedu Francis Nwafili Date: Wed, 16 Dec 2020 12:02:54 -0500 Subject: [PATCH] Add scalar multiplication to DQ --- src/geometry/dual_quaternion_ops.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/geometry/dual_quaternion_ops.rs b/src/geometry/dual_quaternion_ops.rs index b6c5afaa4..13b880a67 100644 --- a/src/geometry/dual_quaternion_ops.rs +++ b/src/geometry/dual_quaternion_ops.rs @@ -5,6 +5,7 @@ * * (Assignment Operators) * + * DualQuaternion × Scalar * DualQuaternion × DualQuaternion * * --- @@ -33,3 +34,18 @@ where } } } + +impl Mul for DualQuaternion +where + N::Element: Scalar + SimdValue + SimdRealField, + DefaultAllocator: Allocator + Allocator, +{ + type Output = DualQuaternion; + + fn mul(self, rhs: N) -> Self::Output { + Self { + rot: self.rot * rhs, + trans: self.trans * rhs, + } + } +}