From a91bdbaff49420f0b09f62821d35b434fe8a00e2 Mon Sep 17 00:00:00 2001 From: Myrddin Dundragon Date: Wed, 11 Feb 2026 09:59:21 -0500 Subject: [PATCH] Adjusted the comments to be more accurate. Before I headed into the refresh of this library I wanted to write and adjust somethings comments I had noticed. --- src/quaternion.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/quaternion.rs b/src/quaternion.rs index 3ebaae4..c9c048d 100644 --- a/src/quaternion.rs +++ b/src/quaternion.rs @@ -17,7 +17,7 @@ use crate::vector::{EuclideanVector, Vector3}; /// A Quaternion is a combination of a scalar and a vector -/// of complex numbers. +/// of imaginary units. /// /// [S, V] = [S, Xi + Yj + Zk] /// @@ -28,9 +28,9 @@ use crate::vector::{EuclideanVector, Vector3}; /// /// | | | /// |:-------:|:-------:| -/// | ij = 1 | ik = -1 | -/// | jk = 1 | kj = -1 | -/// | ki = 1 | ji = -1 | +/// | ij = k | ji = -k | +/// | jk = i | kj = -i | +/// | ki = j | ik = -j | #[derive(Clone, Copy)] pub struct Quaternion { @@ -274,6 +274,11 @@ impl Quaternion where T: Trig /// conjugate of this Quaternion. pub fn invert(&self) -> Quaternion { + // This only works for unit quaternions and the normalize here is doing + // the heavy lifting of fixing my drift for my skeleton rotations. + // + // JTS: To reuse this code for other domains, this needs to become the + // conjugate divided by the magnitude squared. self.conjugate().normalize() }