Struct tensor_rs::quaternion::Quaternion
source · [−]pub struct Quaternion<T> { /* private fields */ }
Implementations
sourceimpl<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
sourceimpl<T: Debug> Debug for Quaternion<T>
impl<T: Debug> Debug for Quaternion<T>
sourceimpl<T> Default for Quaternion<T> where
T: Float,
impl<T> Default for Quaternion<T> where
T: Float,
sourceimpl<T> Div<T> for Quaternion<T> where
T: Float,
impl<T> Div<T> for Quaternion<T> where
T: Float,
sourceimpl<T: PartialEq> PartialEq<Quaternion<T>> for Quaternion<T>
impl<T: PartialEq> PartialEq<Quaternion<T>> for Quaternion<T>
sourcefn eq(&self, other: &Quaternion<T>) -> bool
fn eq(&self, other: &Quaternion<T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Quaternion<T>) -> bool
fn ne(&self, other: &Quaternion<T>) -> bool
This method tests for !=
.
impl<T> StructuralPartialEq for Quaternion<T>
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more