diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index b58d885c5..49656b2cd 100644 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -124,6 +124,12 @@ impl Quaternion { Self::from(self.coords.normalize()) } + /// The imaginary part of this quaternion. + #[inline] + pub fn imag(&self) -> Vector3 { + self.coords.xyz() + } + /// The conjugate of this quaternion. /// /// # Example @@ -135,13 +141,7 @@ impl Quaternion { /// ``` #[inline] pub fn conjugate(&self) -> Self { - let v = Vector4::new( - -self.coords[0], - -self.coords[1], - -self.coords[2], - self.coords[3], - ); - Self::from(v) + Self::from_parts(self.w, -self.imag()) } /// Inverts this quaternion if it is not zero.