Quat

Struct Quat 

Source
pub struct Quat<T> {
    pub x: T,
    pub y: T,
    pub z: T,
    pub w: T,
}

Fields§

§x: T§y: T§z: T§w: T

Implementations§

Source§

impl<T> Quat<T>
where T: Copy,

Source

pub fn new(x: T, y: T, z: T, w: T) -> Self

Creates a new Quat from multiple components

Source

pub fn len() -> usize

Source

pub fn to_tuple(&self) -> (T, T, T, T)

Source§

impl<T> Quat<T>
where T: Vec + Math,

Source

pub fn rotation_x(theta: T) -> Self

Source

pub fn rotation_y(theta: T) -> Self

Source

pub fn rotation_z(theta: T) -> Self

Source

pub fn rotation(axis: &Vec3<T>, theta: T) -> Self

Source

pub fn direction(a: &Vec3<T>, b: &Vec3<T>) -> Self

Source

pub fn euler_xyz(euler: &Vec3<T>) -> Self

Source

pub fn euler_zxy(euler: &Vec3<T>) -> Self

Source

pub fn dot(&self, b: Self) -> T

Source

pub fn cross(&self, b: Self) -> Self

Source

pub fn length2(&self) -> T

Source

pub fn length(&self) -> T

Source

pub fn distance(&self, b: Self) -> T

Source

pub fn normalize(&self) -> Self

Source

pub fn axis(&self) -> Vec3<T>

Source

pub fn angle(&self) -> T

Source

pub fn conjugate(&self) -> Self

Source

pub fn inverse(&self) -> Self

Trait Implementations§

Source§

impl<T> Add for Quat<T>
where T: Add<Output = T>,

Source§

type Output = Quat<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl<T> AddAssign for Quat<T>
where T: AddAssign<T>,

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<T> AsMut<Quat<T>> for Quat<T>

Source§

fn as_mut(&mut self) -> &mut Quat<T>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T> AsRef<Quat<T>> for Quat<T>

Source§

fn as_ref(&self) -> &Quat<T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> Binary for Quat<T>
where T: Vec + Math,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Clone> Clone for Quat<T>

Source§

fn clone(&self) -> Quat<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Quat<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for Quat<T>

Source§

fn default() -> Quat<T>

Returns the “default value” for a type. Read more
Source§

impl<T> Display for Quat<T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Div<T> for Quat<T>
where T: Div<Output = T> + Copy,

Source§

type Output = Quat<T>

The resulting type after applying the / operator.
Source§

fn div(self, s: T) -> Self

Performs the / operation. Read more
Source§

impl<T> Div for Quat<T>
where T: Div<Output = T>,

Source§

type Output = Quat<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
Source§

impl<'a, T> DivAssign<&'a T> for Quat<T>
where T: DivAssign<T> + Copy,

Source§

fn div_assign(&mut self, s: &'a T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign<T> for Quat<T>
where T: DivAssign<T> + Copy,

Source§

fn div_assign(&mut self, s: T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign for Quat<T>
where T: DivAssign<T>,

Source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
Source§

impl<T> From<[T; 4]> for Quat<T>
where T: Copy + Div<Output = T>,

Source§

fn from(v: [T; 4]) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(T, T, T, T)> for Quat<T>
where T: Copy + Div<Output = T>,

Source§

fn from(v: (T, T, T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T: Vec> From<Quat<T>> for Mat4<T>

Source§

fn from(q: Quat<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Vec4<T>> for Quat<T>
where T: Copy + Div<Output = T>,

Source§

fn from(v: Vec4<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for Quat<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Interpolation<T> for Quat<T>
where T: Copy + One + Mul<Output = T> + Add<Output = T> + Sub<Output = T>,

Source§

fn lerp(self, b: Self, t: T) -> Self

Source§

impl<T> Math for Quat<T>
where T: Copy + Math,

Source§

fn abs(self) -> Self

Source§

fn recip(self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn rsqrt(self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn sincos(self) -> (Quat<T>, Quat<T>)

Source§

fn acos(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn log(self, _rhs: Self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn to_radians(self) -> Self

Source§

fn to_degrees(self) -> Self

Source§

fn min(self, _rhs: Self) -> Self

Source§

fn max(self, _rhs: Self) -> Self

Source§

fn saturate(self) -> Self

Source§

fn snorm2unorm(self) -> Self

Source§

fn unorm2snorm(self) -> Self

Source§

fn clamp(self, minval: Self, maxval: Self) -> Self

Source§

impl<T> Mul<T> for Quat<T>
where T: Mul<Output = T> + Copy,

Source§

type Output = Quat<T>

The resulting type after applying the * operator.
Source§

fn mul(self, s: T) -> Self

Performs the * operation. Read more
Source§

impl<T> Mul for Quat<T>
where T: Mul<Output = T>,

Source§

type Output = Quat<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
Source§

impl<'a, T> MulAssign<&'a T> for Quat<T>
where T: MulAssign<T> + Copy,

Source§

fn mul_assign(&mut self, other: &'a T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign<T> for Quat<T>
where T: MulAssign<T> + Copy,

Source§

fn mul_assign(&mut self, s: T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign for Quat<T>
where T: MulAssign<T>,

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl<T> Neg for Quat<T>
where T: Neg<Output = T>,

Source§

type Output = Quat<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<T> One for Quat<T>
where T: One,

Source§

fn one() -> Self

Source§

impl<T: PartialEq> PartialEq for Quat<T>

Source§

fn eq(&self, other: &Quat<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Sub for Quat<T>
where T: Sub<Output = T>,

Source§

type Output = Quat<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
Source§

impl<T> SubAssign for Quat<T>
where T: SubAssign<T>,

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<T> Zero for Quat<T>
where T: Zero,

Source§

fn zero() -> Self

Source§

impl<T: Copy> Copy for Quat<T>

Source§

impl<T: Eq> Eq for Quat<T>

Source§

impl<T> StructuralPartialEq for Quat<T>

Auto Trait Implementations§

§

impl<T> Freeze for Quat<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Quat<T>
where T: RefUnwindSafe,

§

impl<T> Send for Quat<T>
where T: Send,

§

impl<T> Sync for Quat<T>
where T: Sync,

§

impl<T> Unpin for Quat<T>
where T: Unpin,

§

impl<T> UnwindSafe for Quat<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.