Trait Rotation

Source
pub trait Rotation<const SIZE: usize>
where Self: Collection,
{ const SIZE: usize = SIZE; // Required methods fn look_at<Dir, Up>(dir: &Dir, up: &Up) -> Self where Dir: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>, Up: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>; fn between_vectors<A, B>(a: &A, b: &B) -> Self where A: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>, B: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>; fn rotate_vector<V>(&self, vec: &mut V) where V: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>; fn invert(&self) -> Self; }
Expand description

Trait for representing and manipulating rotations.

This trait provides methods for creating and manipulating rotations, allowing for operations such as aligning vectors, rotating vectors, and inverting rotations.

Provided Associated Constants§

Source

const SIZE: usize = SIZE

The size of the vector space.

Required Methods§

Source

fn look_at<Dir, Up>(dir: &Dir, up: &Up) -> Self
where Dir: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>, Up: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>,

Creates a rotation that aligns the dir vector with the forward direction, using up as the reference for the up direction.

§Parameters
  • dir: The direction vector to align with the forward direction.
  • up: The reference up vector.
§Returns
  • A rotation that aligns dir with the forward direction.
Source

fn between_vectors<A, B>(a: &A, b: &B) -> Self
where A: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>, B: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>,

Creates a rotation that aligns vector a with vector b.

§Parameters
  • a: The initial vector.
  • b: The target vector.
§Returns
  • A rotation that aligns a with b.
Source

fn rotate_vector<V>(&self, vec: &mut V)
where V: VectorSpace<SIZE> + Collection<Scalar = <Self as Collection>::Scalar>,

Rotates a vector by this rotation.

§Parameters
  • vec: The vector to rotate.
§Returns
  • The rotated vector.
Source

fn invert(&self) -> Self

Inverts this rotation.

§Returns
  • The inverse of this rotation.

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§