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:
@ -17,7 +17,7 @@ use crate::vector::{EuclideanVector, Vector3};
|
|||||||
|
|
||||||
|
|
||||||
/// A Quaternion is a combination of a scalar and a vector
|
/// A Quaternion is a combination of a scalar and a vector
|
||||||
/// of complex numbers.
|
/// of imaginary units.
|
||||||
///
|
///
|
||||||
/// [S, V] = [S, Xi + Yj + Zk]
|
/// [S, V] = [S, Xi + Yj + Zk]
|
||||||
///
|
///
|
||||||
@ -28,9 +28,9 @@ use crate::vector::{EuclideanVector, Vector3};
|
|||||||
///
|
///
|
||||||
/// | | |
|
/// | | |
|
||||||
/// |:-------:|:-------:|
|
/// |:-------:|:-------:|
|
||||||
/// | ij = 1 | ik = -1 |
|
/// | ij = k | ji = -k |
|
||||||
/// | jk = 1 | kj = -1 |
|
/// | jk = i | kj = -i |
|
||||||
/// | ki = 1 | ji = -1 |
|
/// | ki = j | ik = -j |
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct Quaternion<T>
|
pub struct Quaternion<T>
|
||||||
{
|
{
|
||||||
@ -274,6 +274,11 @@ impl<T> Quaternion<T> where T: Trig
|
|||||||
/// conjugate of this Quaternion.
|
/// conjugate of this Quaternion.
|
||||||
pub fn invert(&self) -> Quaternion<T>
|
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()
|
self.conjugate().normalize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user