# [−][src]Trait cgmath::Rotation

    pub trait Rotation<P: EuclideanSpace>: Sized + Copy + One where
        Self: AbsDiffEq<Epsilon = P::Scalar>,
        Self: RelativeEq<Epsilon = P::Scalar>,
        Self: UlpsEq<Epsilon = P::Scalar>,
        P::Scalar: BaseFloat,
        Self: Product<Self>, {
        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;

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

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

### `fn look_at(dir: P::Diff, up: P::Diff) -> Self`

Create a rotation to a given direction with an 'up' vector.

### `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.

### `fn rotate_vector(&self, vec: P::Diff) -> P::Diff`

Rotate a vector using this rotation.

### `fn invert(&self) -> Self`

Create a new rotation which "un-does" this rotation. That is, `r * r.invert()` is the identity.

Loading content...

## Provided methods

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

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

Loading content...

## Implementors

### `impl<S: BaseFloat> Rotation<Point2<S>> for Basis2<S>`[src]

#### `fn look_at(dir: Vector2<S>, up: Vector2<S>) -> Basis2<S>`[src]

#### `fn between_vectors(a: Vector2<S>, b: Vector2<S>) -> Basis2<S>`[src]

#### `fn rotate_vector(&self, vec: Vector2<S>) -> Vector2<S>`[src]

#### `fn invert(&self) -> Basis2<S>`[src]

### `impl<S: BaseFloat> Rotation<Point3<S>> for Quaternion<S>`[src]

#### `fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S>`[src]

#### `fn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Quaternion<S>`[src]

#### `fn rotate_vector(&self, vec: Vector3<S>) -> Vector3<S>`[src]

#### `fn invert(&self) -> Quaternion<S>`[src]

### `impl<S: BaseFloat> Rotation<Point3<S>> for Basis3<S>`[src]

#### `fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S>`[src]

#### `fn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Basis3<S>`[src]

#### `fn rotate_vector(&self, vec: Vector3<S>) -> Vector3<S>`[src]

#### `fn invert(&self) -> Basis3<S>`[src]

Loading content...

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)