Skip to content

Commit

Permalink
Add scalar multiplication to DQ
Browse files Browse the repository at this point in the history
  • Loading branch information
chinedufn committed Dec 16, 2020
1 parent 6bb5503 commit 3ed1452
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/geometry/dual_quaternion_ops.rs
Expand Up @@ -5,6 +5,7 @@
*
* (Assignment Operators)
*
* DualQuaternion × Scalar
* DualQuaternion × DualQuaternion
*
* ---
Expand Down Expand Up @@ -33,3 +34,18 @@ where
}
}
}

impl<N: Scalar + SimdValue + SimdRealField> Mul<N> for DualQuaternion<N>
where
N::Element: Scalar + SimdValue + SimdRealField,
DefaultAllocator: Allocator<N, U4, U1> + Allocator<N, U4, U1>,
{
type Output = DualQuaternion<N>;

fn mul(self, rhs: N) -> Self::Output {
Self {
rot: self.rot * rhs,
trans: self.trans * rhs,
}
}
}

0 comments on commit 3ed1452

Please sign in to comment.