[][src]Struct tray_rust::linalg::quaternion::Quaternion

pub struct Quaternion {
    pub v: Vector,
    pub w: f32,
}

Quaternions describe a rotation in 3d space but can be properly interpolated unlike rotation matrices. The quaternion also provides methods to compute the corresponding rotation transform so that it can be composed with scaling and translation

Fields

v: Vectorw: f32

Methods

impl Quaternion[src]

pub fn identity() -> Quaternion[src]

Construct an identity quaternion

pub fn from_matrix(m: &Matrix4) -> Quaternion[src]

Construct a quaternion from the rotation matrix Based on Shoemake 1991

pub fn from_transform(t: &Transform) -> Quaternion[src]

Construct the quaternion from the transform

pub fn to_matrix(&self) -> Matrix4[src]

Get the rotation transform described by this quaternion

pub fn to_transform(&self) -> Transform[src]

Get the rotation transform described by this quaternion

pub fn normalized(&self) -> Quaternion[src]

Get the normalized quaternion for this rotation

Trait Implementations

impl Clone for Quaternion[src]

impl Copy for Quaternion[src]

impl Debug for Quaternion[src]

impl Div<f32> for Quaternion[src]

type Output = Quaternion

The resulting type after applying the / operator.

fn div(self, rhs: f32) -> Quaternion[src]

Divide the quaternion by a scalar

impl Sub<Quaternion> for Quaternion[src]

type Output = Quaternion

The resulting type after applying the - operator.

fn sub(self, rhs: Quaternion) -> Quaternion[src]

Subtract two quaternions

impl Add<Quaternion> for Quaternion[src]

type Output = Quaternion

The resulting type after applying the + operator.

fn add(self, rhs: Quaternion) -> Quaternion[src]

Add two quaternions

impl Mul<f32> for Quaternion[src]

type Output = Quaternion

The resulting type after applying the * operator.

fn mul(self, rhs: f32) -> Quaternion[src]

Multiply the quaternion by a scalar

impl Mul<Quaternion> for f32[src]

type Output = Quaternion

The resulting type after applying the * operator.

fn mul(self, rhs: Quaternion) -> Quaternion[src]

Multiply the quaternion by a scalar

impl Neg for Quaternion[src]

type Output = Quaternion

The resulting type after applying the - operator.

fn neg(self) -> Quaternion[src]

Negate the quaternion

Auto Trait Implementations

impl Send for Quaternion

impl Sync for Quaternion

impl Unpin for Quaternion

impl UnwindSafe for Quaternion

impl RefUnwindSafe for Quaternion

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Interpolate for T where
    T: Add<T, Output = T> + Mul<f32, Output = T> + Copy
[src]

impl<T> SetParameter for T[src]