Skip to main content

Rotation

Trait Rotation 

Source
pub trait Rotation: Copy {
    // Required methods
    fn identity() -> Self;
    fn inverted(self) -> Self;
    fn combine(&self, other: &Self) -> Self;
}
Expand description

Describes the transformation from one orthonormal basis to another.

A Rotation represents a single rotation operation. Rotations change the direction of a vector while keeping its magnitude constant. To maintain generality, this documentation shows rotations mathematically as functions:

\vec{b} = R(\vec{a})

All types that implement Rotation should implement Rotate for at least one vector type.

Required Methods§

Source

fn identity() -> Self

The identity rotation.

\vec{a} = I(\vec{a})
Source

fn inverted(self) -> Self

Inverse the rotation.

\vec{a} = R^{-1}(R(\vec{a}))
§Example
let r_inverse = r.inverted();
Source

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

Combine two rotations.

The resulting rotation R_ab will rotate by first R_b followed by a rotation of R_a.

R_{ab}(\vec{v})= R_a(R_b(\vec{v}))
§Example
let R_ab = R_a.combine(R_b);

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§