Trait cgmath::Rotation

source ·
pub trait Rotation<P: Point>: PartialEq + Sizedwhere
    Self: ApproxEq<Epsilon = <P as Point>::Scalar>,
    <P as Point>::Scalar: BaseFloat,{
    // Required methods
    fn one() -> Self;
    fn look_at(dir: P::Vector, up: P::Vector) -> Self;
    fn between_vectors(a: P::Vector, b: P::Vector) -> Self;
    fn rotate_vector(&self, vec: P::Vector) -> P::Vector;
    fn concat(&self, other: &Self) -> Self;
    fn invert(&self) -> Self;

    // Provided methods
    fn rotate_point(&self, point: P) -> P { ... }
    fn concat_self(&mut self, other: &Self) { ... }
    fn invert_self(&mut self) { ... }
}
Expand description

A trait for a generic rotation. A rotation is a transformation that creates a circular motion, and preserves at least one point in the space.

Required Methods§

source

fn one() -> Self

Create the identity transform (causes no transformation).

source

fn look_at(dir: P::Vector, up: P::Vector) -> Self

Create a rotation to a given direction with an ‘up’ vector

source

fn between_vectors(a: P::Vector, b: P::Vector) -> Self

Create a shortest rotation to transform vector ‘a’ into ‘b’. Both given vectors are assumed to have unit length.

source

fn rotate_vector(&self, vec: P::Vector) -> P::Vector

Rotate a vector using this rotation.

source

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

Create a new rotation which combines both this rotation, and another.

source

fn invert(&self) -> Self

Create a new rotation which “un-does” this rotation. That is, r.concat(r.invert()) is the identity.

Provided Methods§

source

fn rotate_point(&self, point: P) -> P

Rotate a point using this rotation, by converting it to its representation as a vector.

source

fn concat_self(&mut self, other: &Self)

Modify this rotation in-place by combining it with another.

source

fn invert_self(&mut self)

Invert this rotation in-place.

Implementors§