Skip to main content

Rotation

Struct Rotation 

Source
pub struct Rotation<From: Frame, To: Frame> { /* private fields */ }
Expand description

A rotation from one frame to another.

PhantomData<fn(From) -> To> rather than PhantomData<(From, To)>: it gives the correct variance and keeps Rotation unconditionally Send + Sync regardless of the tag types, which are never values anyway.

Implementations§

Source§

impl<From: Frame, To: Frame> Rotation<From, To>

Source

pub const fn from_matrix(matrix: Mat3) -> Self

Wrap a matrix, asserting by construction which frames it connects.

The only place a frame claim is made rather than checked. Everything downstream is then checked by the compiler.

Two things are asserted here and not checked: the frames, and that the matrix is a proper rotation. The second is not decoration — derivations/frame_transform.mac shows Transform::inverse inverts Transform::state only when det = +1, and misses by −2 ω × r when it is −1. A reflection would typecheck.

Source

pub const fn matrix(self) -> Mat3

The underlying matrix.

Source

pub fn inverse(self) -> Rotation<To, From>

The inverse rotation. For a proper rotation, the transpose.

Trait Implementations§

Source§

impl<From: Clone + Frame, To: Clone + Frame> Clone for Rotation<From, To>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<From: Copy + Frame, To: Copy + Frame> Copy for Rotation<From, To>

Source§

impl<From: Debug + Frame, To: Debug + Frame> Debug for Rotation<From, To>

Source§

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

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

impl<A: Frame, B: Frame> Mul<Position<A>> for Rotation<A, B>

Source§

type Output = Position<B>

The resulting type after applying the * operator.
Source§

fn mul(self, v: Position<A>) -> Position<B>

Performs the * operation. Read more
Source§

impl<A: Frame, B: Frame, C: Frame> Mul<Rotation<A, B>> for Rotation<B, C>

Source§

fn mul(self, rhs: Rotation<A, B>) -> Rotation<A, C>

Compose: apply the right operand first.

b_to_c * a_to_b is a_to_c. Any other pairing fails to typecheck, which is the entire point of this module.

Source§

type Output = Rotation<A, C>

The resulting type after applying the * operator.
Source§

impl<A: Frame, B: Frame> Mul<Velocity<A>> for Rotation<A, B>

Source§

type Output = Velocity<B>

The resulting type after applying the * operator.
Source§

fn mul(self, v: Velocity<A>) -> Velocity<B>

Performs the * operation. Read more
Source§

impl<From: PartialEq + Frame, To: PartialEq + Frame> PartialEq for Rotation<From, To>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<From: PartialEq + Frame, To: PartialEq + Frame> StructuralPartialEq for Rotation<From, To>

Auto Trait Implementations§

§

impl<From, To> Freeze for Rotation<From, To>
where PhantomData<fn(From) -> To>: Freeze,

§

impl<From, To> RefUnwindSafe for Rotation<From, To>
where PhantomData<fn(From) -> To>: RefUnwindSafe,

§

impl<From, To> Send for Rotation<From, To>
where PhantomData<fn(From) -> To>: Send,

§

impl<From, To> Sync for Rotation<From, To>
where PhantomData<fn(From) -> To>: Sync,

§

impl<From, To> Unpin for Rotation<From, To>
where PhantomData<fn(From) -> To>: Unpin,

§

impl<From, To> UnsafeUnpin for Rotation<From, To>
where PhantomData<fn(From) -> To>: UnsafeUnpin,

§

impl<From, To> UnwindSafe for Rotation<From, To>
where PhantomData<fn(From) -> To>: 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.