diff --git a/src/geometry/dual_quaternion_ops.rs b/src/geometry/dual_quaternion_ops.rs index 13b880a67..5d3e31e25 100644 --- a/src/geometry/dual_quaternion_ops.rs +++ b/src/geometry/dual_quaternion_ops.rs @@ -7,6 +7,8 @@ * * DualQuaternion × Scalar * DualQuaternion × DualQuaternion + * DualQuaternion + DualQuaternion + * DualQuaternion - DualQuaternion * * --- * @@ -18,7 +20,7 @@ use crate::base::allocator::Allocator; use crate::{DefaultAllocator, DualQuaternion, Scalar, SimdRealField, U1, U4}; use simba::simd::SimdValue; -use std::ops::Mul; +use std::ops::{Add, Mul, Sub}; impl Mul> for DualQuaternion where @@ -49,3 +51,33 @@ where } } } + +impl Add> for DualQuaternion +where + N::Element: Scalar + SimdValue + SimdRealField, + DefaultAllocator: Allocator + Allocator, +{ + type Output = DualQuaternion; + + fn add(self, rhs: DualQuaternion) -> Self::Output { + Self { + rot: self.rot + rhs.rot, + trans: self.trans + rhs.trans, + } + } +} + +impl Sub> for DualQuaternion +where + N::Element: Scalar + SimdValue + SimdRealField, + DefaultAllocator: Allocator + Allocator, +{ + type Output = DualQuaternion; + + fn sub(self, rhs: DualQuaternion) -> Self::Output { + Self { + rot: self.rot - rhs.rot, + trans: self.trans - rhs.trans, + } + } +}