# Trait bevy::math::VectorSpace

```
pub trait VectorSpace: Mul<f32, Output = Self> + Div<f32, Output = Self> + Add<Output = Self> + Sub<Output = Self> + Neg + Default + Debug + Clone + Copy {
const ZERO: Self;
// Provided method
fn lerp(&self, rhs: Self, t: f32) -> Self { ... }
}
```

## Expand description

A type that supports the mathematical operations of a real vector space, irrespective of dimension. In particular, this means that the implementing type supports:

- Scalar multiplication and division on the right by elements of
`f32`

- Negation
- Addition and subtraction
- Zero

Within the limitations of floating point arithmetic, all the following are required to hold:

- (Associativity of addition) For all
`u, v, w: Self`

,`(u + v) + w == u + (v + w)`

. - (Commutativity of addition) For all
`u, v: Self`

,`u + v == v + u`

. - (Additive identity) For all
`v: Self`

,`v + Self::ZERO == v`

. - (Additive inverse) For all
`v: Self`

,`v - v == v + (-v) == Self::ZERO`

. - (Compatibility of multiplication) For all
`a, b: f32`

,`v: Self`

,`v * (a * b) == (v * a) * b`

. - (Multiplicative identity) For all
`v: Self`

,`v * 1.0 == v`

. - (Distributivity for vector addition) For all
`a: f32`

,`u, v: Self`

,`(u + v) * a == u * a + v * a`

. - (Distributivity for scalar addition) For all
`a, b: f32`

,`v: Self`

,`v * (a + b) == v * a + v * b`

.

Note that, because implementing types use floating point arithmetic, they are not required to actually
implement `PartialEq`

or `Eq`

.

## Required Associated Constants§

#### const ZERO: Self

#### const ZERO: Self

The zero vector, which is the identity of addition for the vector space type.

## Provided Methods§

#### fn lerp(&self, rhs: Self, t: f32) -> Self

#### fn lerp(&self, rhs: Self, t: f32) -> Self

Perform vector space linear interpolation between this element and another, based
on the parameter `t`

. When `t`

is `0`

, `self`

is recovered. When `t`

is `1`

, `rhs`

is recovered.

Note that the value of `t`

is not clamped by this function, so interpolating outside
of the interval `[0,1]`

is allowed.

## Object Safety§

This trait is

**not**object safe.