# [−][src]Trait cgmath::prelude::InnerSpace

    pub trait InnerSpace: VectorSpace where
        Self::Scalar: BaseFloat,
        Self: MetricSpace<Metric = Self::Scalar>,
        Self: UlpsEq<Epsilon = Self::Scalar>, {
        fn dot(self, other: Self) -> Self::Scalar;

        fn is_perpendicular(self, other: Self) -> bool { ... }
        fn magnitude2(self) -> Self::Scalar { ... }
        fn magnitude(self) -> Self::Scalar { ... }
        fn angle(self, other: Self) -> Rad<Self::Scalar> { ... }
        fn normalize(self) -> Self { ... }
        fn normalize_to(self, magnitude: Self::Scalar) -> Self { ... }
        fn project_on(self, other: Self) -> Self { ... }
    }

Vectors that also have a dot (or inner) product.

The dot product allows for the definition of other useful operations, like finding the magnitude of a vector or normalizing it.

Examples include vectors and quaternions.

## Required methods

### `fn dot(self, other: Self) -> Self::Scalar`

Vector dot (or inner) product.

Loading content...

## Provided methods

### `fn is_perpendicular(self, other: Self) -> bool`

Returns `true` if the vector is perpendicular (at right angles) to the other vector.

### `fn magnitude2(self) -> Self::Scalar`

Returns the squared magnitude.

This does not perform an expensive square root operation like in `InnerSpace::magnitude` method, and so can be used to compare magnitudes more efficiently.

### `fn magnitude(self) -> Self::Scalar`

The distance from the tail to the tip of the vector.

### `fn angle(self, other: Self) -> Rad<Self::Scalar>`

Returns the angle between two vectors in radians.

### `fn normalize(self) -> Self`

Returns a vector with the same direction, but with a magnitude of `1`.

### `fn normalize_to(self, magnitude: Self::Scalar) -> Self`

Returns a vector with the same direction and a given magnitude.

### `fn project_on(self, other: Self) -> Self`

Returns the vector projection of the current inner space projected onto the supplied argument.

Loading content...

## Implementors

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

#### `fn dot(self, other: Quaternion<S>) -> S`[src]

### `impl<S: BaseFloat> InnerSpace for Vector1<S>`[src]

#### `fn dot(self, other: Vector1<S>) -> S`[src]

### `impl<S: BaseFloat> InnerSpace for Vector2<S>`[src]

#### `fn dot(self, other: Vector2<S>) -> S`[src]

#### `fn angle(self, other: Vector2<S>) -> Rad<S>`[src]

### `impl<S: BaseFloat> InnerSpace for Vector3<S>`[src]

#### `fn dot(self, other: Vector3<S>) -> S`[src]

#### `fn angle(self, other: Vector3<S>) -> Rad<S>`[src]

### `impl<S: BaseFloat> InnerSpace for Vector4<S>`[src]

#### `fn dot(self, other: Vector4<S>) -> 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`)