Trait cgmath::prelude::Rotation

source ·
pub trait Rotation<P: EuclideanSpace>: Sized + Copy + Onewhere
    Self: ApproxEq<Epsilon = P::Scalar> + Product<Self>,
    P::Scalar: BaseFloat,{
    // Required methods
    fn look_at(dir: P::Diff, up: P::Diff) -> Self;
    fn between_vectors(a: P::Diff, b: P::Diff) -> Self;
    fn rotate_vector(&self, vec: P::Diff) -> P::Diff;
    fn invert(&self) -> Self;

    // Provided method
    fn rotate_point(&self, point: P) -> P { ... }
}
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 look_at(dir: P::Diff, up: P::Diff) -> Self

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

source

fn between_vectors(a: P::Diff, b: P::Diff) -> 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::Diff) -> P::Diff

Rotate a vector using this rotation.

source

fn invert(&self) -> Self

Create a new rotation which “un-does” this rotation. That is, r * 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.

Implementors§