Quat

Struct Quat 

Source
#[repr(C)]
pub struct Quat<F>
where F: Float,
{ /* private fields */ }

Implementations§

Source§

impl<F> Quat<F>
where F: Float,

Source

pub fn new(v: Vec3<F>, w: F) -> Self

Creates new quaternion.

Source

pub fn new_vector(v: Vec3<F>) -> Self

Creates new quaternion with v as vector part and 0 for scalar.

Source

pub fn new_axis_rotation(axis: Vec3<F>, angle: F) -> Self

Creates new quaternion that represents a rotation around axis by angle radians. Method can accept denormalized input.

Source

pub fn new_dst_rotation(from: Vec3<F>, to: Vec3<F>) -> Self

Creates new quaternion that represents a rotation that moves vector from to vector to.

Source

pub fn into_axis_angle(self) -> (Vec3<F>, F)

Recovers angle axis representation of the quaternion.

Source

pub fn rotate(&self, v: Vec3<F>) -> Vec3<F>

Rotates vector v by the rotation defined by this quaternion.

Source

pub fn zero() -> Self

Creates new zero quaternion.

Source

pub fn idenitity() -> Self

Creates new identity quaternion.

Source

pub fn from_parts(x: F, y: F, z: F, w: F) -> Self

Creates new quaternion from individual parts.

Source

pub fn conjugate(&self) -> Self

Computes the conjugate of the quaternion.

Source

pub fn norm(&self) -> F

Computes the norm of the quaternion.

Source

pub fn sqrt_norm(&self) -> F

Computes the squared norm of the quaternion.

Source

pub fn normalize(&self) -> Self

Normalizes quaternion preserving direction but reducing its norm to 1.

Source

pub fn reciprocal(&self) -> Self

Computes the reciprocal of the quaternion.

Source

pub fn combine(self, other: Self) -> Self

Combines two rotations. Applying self first and then `other.

Source

pub fn product(&self, other: Self) -> Self

Computes the hamilton product between two vectors.

Trait Implementations§

Source§

impl<F> Add for Quat<F>
where F: Float,

Source§

type Output = Quat<F>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<F> AddAssign for Quat<F>
where F: Float,

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<F> Clone for Quat<F>
where F: Float + Clone,

Source§

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

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<F> Debug for Quat<F>
where F: Float + Debug,

Source§

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

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

impl<F> Default for Quat<F>
where F: Float + Default,

Source§

fn default() -> Quat<F>

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

impl<F> Div<F> for Quat<F>
where F: Float,

Source§

type Output = Quat<F>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: F) -> Self::Output

Performs the / operation. Read more
Source§

impl<F> DivAssign<F> for Quat<F>
where F: Float,

Source§

fn div_assign(&mut self, rhs: F)

Performs the /= operation. Read more
Source§

impl<F> Mul<F> for Quat<F>
where F: Float,

Source§

type Output = Quat<F>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: F) -> Self::Output

Performs the * operation. Read more
Source§

impl<F> MulAssign<F> for Quat<F>
where F: Float,

Source§

fn mul_assign(&mut self, rhs: F)

Performs the *= operation. Read more
Source§

impl<F> PartialEq for Quat<F>
where F: Float + PartialEq,

Source§

fn eq(&self, other: &Quat<F>) -> 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<F> Sub for Quat<F>
where F: Float,

Source§

type Output = Quat<F>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<F> SubAssign for Quat<F>
where F: Float,

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<F> Copy for Quat<F>
where F: Float + Copy,

Source§

impl<F> StructuralPartialEq for Quat<F>
where F: Float,

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<F> UnwindSafe for Quat<F>
where F: 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, 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.