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.
This commit is contained in:
2026-02-11 09:59:21 -05:00
parent b1fdbeb3de
commit a91bdbaff4

View File

@ -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<T>
{
@ -274,6 +274,11 @@ impl<T> Quaternion<T> where T: Trig
/// conjugate of this Quaternion.
pub fn invert(&self) -> Quaternion<T>
{
// 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()
}