Struct static_math::quaternion::Quaternion  [−][src]
pub struct Quaternion<T> {
    pub q0: T,
    pub q: V3<T>,
    // some fields omitted
}Quaternion type
Fields
q0: TScalar part
q: V3<T>Imaginary part
Implementations
impl<T> Quaternion<T>[src]
pub const fn new(q0: T, q: V3<T>) -> Self[src]
construct a new Quaternion from a number(real part) and a vector(imag part)
pub fn new_from(q0: T, q1: T, q2: T, q3: T) -> Self[src]
construct a new Quaternion zrom four numbers
impl<T: Num + Copy> Quaternion<T>[src]
pub fn dot(&self, rhs: Self) -> T[src]
dot product
pub fn real(&self) -> T[src]
get the real part
pub fn imag(&self) -> V3<T>[src]
get the imaginary part
pub fn one() -> Quaternion<T>[src]
construct a unit Quaternion
pub fn zero() -> Self[src]
construct a zero Quaternion
pub fn new_real(q0: T) -> Self[src]
construct a pure “real” Quaternion
pub fn new_imag(q: V3<T>) -> Self[src]
construct a pure “imaginary” Quaternion
pub fn abs2(&self) -> T[src]
calculate the abs2 of the Quaternion
impl<T: Num + Copy + Signed> Quaternion<T>[src]
impl<T: Float> Quaternion<T>[src]
impl<T: Float + Signed> Quaternion<T>[src]
impl<T: Float + FloatConst + Signed> Quaternion<T>[src]
pub fn normalize(&self) -> Option<Self>[src]
normalize the Quaternion only if necesary
pub fn abs_imag(&self) -> T[src]
get the norm of the “imaginary” part
pub fn rotation(theta: T, v: V3<T>) -> Self[src]
generate a Quaternion that represents a rotation of a angle theta
around the axis(normalized) v
pub fn rotation_norm_encoded(v: V3<T>) -> Self[src]
generate a Quaternion that represents a rotation of a angle theta
around the axis(normalized) v, the angle theta is encoded in the
norm of the vector v
pub fn to_rotation(&self) -> M33<T>[src]
pub fn from_euler_angles(yay: T, pitch: T, roll: T) -> Self[src]
create a quaternion that represents the rotation from a Euler angles with the roll-pitch-yay convention
pub fn get_angle(&self) -> T[src]
get the angle of representation from this Quaternion
pub fn get_axis(&self) -> Option<V3<T>>[src]
get the axis of rotation from which this Quaternion represent
pub fn axis_angle(&self) -> (T, Option<V3<T>>)[src]
combine the two previous methods: get_axis and get_angle
pub fn to_euler_angles(&self) -> (T, T, T)[src]
get the euler angles from the Quaternion
pub fn normalize_q(&self) -> Self[src]
normalize the Quaternion
pub fn argq(&self) -> Self[src]
pub fn exp(&self) -> Self[src]
exponential function apply to the current Quaternion
pub fn ln(&self) -> Self[src]
natural logaritmic function apply to the current Quaternion
pub fn sin(&self) -> Self[src]
sin function apply to the current Quaternion
pub fn cos(&self) -> Self[src]
cos function apply to the current Quaternion
pub fn sqrt(&self) -> Self[src]
sqrt function apply to the current Quaternion
pub fn pow(&self, rhs: Self) -> Self[src]
power the current Quaternion to the rhs argument
pub fn slerp(a: Self, b: Self, t: T) -> Self[src]
Brief.
Spherical Linear Interpolation between two Quaternions this implementation follow this implementations: https://www.mrpt.org/tutorials/programming/maths-and-geometry/slerp-interpolation/
Function arguments: a: Quaternion(normalized) b: Quaternion(normalized) t: Float in the closed interval [0.0, 1.0]
Trait Implementations
impl<T: Num + Copy> Add<Quaternion<T>> for Quaternion<T>[src]
type Output = Self
The resulting type after applying the + operator.
fn add(self, rhs: Self) -> Self[src]
impl<T: Clone> Clone for Quaternion<T>[src]
fn clone(&self) -> Quaternion<T>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T: Copy> Copy for Quaternion<T>[src]
impl<T: Debug> Debug for Quaternion<T>[src]
impl<T: Num + Display> Display for Quaternion<T>[src]
impl<T: Float + Signed> Div<Quaternion<T>> for Quaternion<T>[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: Self) -> Self::Output[src]
impl<T: Num + Copy> Div<T> for Quaternion<T>[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: T) -> Self::Output[src]
impl<T: Copy> From<[T; 4]> for Quaternion<T>[src]
fn from(data: [T; 4]) -> Quaternion<T>[src]
impl<T: Num + Copy> Mul<Quaternion<T>> for Quaternion<T>[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: Self) -> Self::Output[src]
impl<T: Num + Copy> Mul<T> for Quaternion<T>[src]
type Output = Quaternion<T>
The resulting type after applying the * operator.
fn mul(self, rhs: T) -> Self::Output[src]
impl<T: Num + Copy + Signed> Mul<V3<T>> for Quaternion<T>[src]
type Output = V3<T>
The resulting type after applying the * operator.
fn mul(self, rhs: V3<T>) -> Self::Output[src]
impl<T: Num + Copy + Signed> Neg for Quaternion<T>[src]
impl<T: Num + Copy> One for Quaternion<T>[src]
fn one() -> Self[src]
Create an identity Quaternion
pub fn set_one(&mut self)[src]
pub fn is_one(&self) -> bool where
    Self: PartialEq<Self>, [src]
Self: PartialEq<Self>,
impl<T: PartialEq> PartialEq<Quaternion<T>> for Quaternion<T>[src]
fn eq(&self, other: &Quaternion<T>) -> bool[src]
fn ne(&self, other: &Quaternion<T>) -> bool[src]
impl<T> StructuralPartialEq for Quaternion<T>[src]
impl<T: Num + Copy> Sub<Quaternion<T>> for Quaternion<T>[src]
type Output = Self
The resulting type after applying the - operator.
fn sub(self, rhs: Self) -> Self[src]
impl<T: Num + Copy> Zero for Quaternion<T>[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Quaternion<T> where
    T: RefUnwindSafe, 
T: RefUnwindSafe,
impl<T> Send for Quaternion<T> where
    T: Send, 
T: Send,
impl<T> Sync for Quaternion<T> where
    T: Sync, 
T: Sync,
impl<T> Unpin for Quaternion<T> where
    T: Unpin, 
T: Unpin,
impl<T> UnwindSafe for Quaternion<T> where
    T: UnwindSafe, 
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
    T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
    T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
    T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
    U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
    T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
    T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
    U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, [src]
U: TryFrom<T>,