pub struct Quaternion<T> { /* private fields */ }
Implementations§
Source§impl<T> Quaternion<T>where
T: Float,
impl<T> Quaternion<T>where
T: Float,
pub fn new(a: T, b: T, c: T, d: T) -> Self
pub fn scalar_part(&self) -> T
pub fn vector_part(&self) -> (T, T, T)
pub fn conjugate(&self) -> Self
pub fn dot(&self, o: &Quaternion<T>) -> T
pub fn len(&self) -> T
pub fn norm(&self) -> T
pub fn inverse(&self) -> Self
Sourcepub fn qm(&self, o: &Quaternion<T>) -> Self
pub fn qm(&self, o: &Quaternion<T>) -> Self
Quaternion multiplication
Sourcepub fn rotation_around_axis(axis: (T, T, T), theta: T) -> Self
pub fn rotation_around_axis(axis: (T, T, T), theta: T) -> Self
Create a quaternion ready to apply to vector for rotation.
pub fn rotate_around_x(theta: T) -> Self
pub fn rotate_around_y(theta: T) -> Self
pub fn rotate_around_z(theta: T) -> Self
Sourcepub fn apply_rotation(&self, v: (T, T, T)) -> (T, T, T)
pub fn apply_rotation(&self, v: (T, T, T)) -> (T, T, T)
Apply unit quaternion to 3d vector for rotation.
pub fn rotate_around_axis(axis: (T, T, T), theta: T, v: (T, T, T)) -> (T, T, T)
pub fn unit_exp(&self, t: T) -> Self
pub fn slerp(p: &Self, q: &Self, t: T) -> Self
Trait Implementations§
Source§impl<T: Debug> Debug for Quaternion<T>
impl<T: Debug> Debug for Quaternion<T>
Source§impl<T> Default for Quaternion<T>where
T: Float,
impl<T> Default for Quaternion<T>where
T: Float,
Source§impl<T> Div<T> for Quaternion<T>where
T: Float,
impl<T> Div<T> for Quaternion<T>where
T: Float,
Source§impl<T: PartialEq> PartialEq for Quaternion<T>
impl<T: PartialEq> PartialEq for Quaternion<T>
impl<T> StructuralPartialEq for Quaternion<T>
Auto Trait Implementations§
impl<T> Freeze for Quaternion<T>where
T: Freeze,
impl<T> RefUnwindSafe for Quaternion<T>where
T: RefUnwindSafe,
impl<T> Send for Quaternion<T>where
T: Send,
impl<T> Sync for Quaternion<T>where
T: Sync,
impl<T> Unpin for Quaternion<T>where
T: Unpin,
impl<T> UnwindSafe for Quaternion<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more