Trait pane::math::Vector2

source ·
pub trait Vector2: Sized {
    type Scalar: Scalar;

Show 14 methods fn x(&self) -> Self::Scalar; fn y(&self) -> Self::Scalar; fn new(x: Self::Scalar, y: Self::Scalar) -> Self; fn map<V>(&self) -> V
    where
        V: Vector2,
        V::Scalar: From<Self::Scalar>
, { ... } fn neg(self) -> Self { ... } fn add<V: Vector2<Scalar = Self::Scalar>>(self, other: V) -> Self { ... } fn sub<V: Vector2<Scalar = Self::Scalar>>(self, other: V) -> Self { ... } fn mul(self, by: Self::Scalar) -> Self { ... } fn mul2<V: Vector2<Scalar = Self::Scalar>>(self, other: V) -> Self { ... } fn div(self, by: Self::Scalar) -> Self { ... } fn div2<V: Vector2<Scalar = Self::Scalar>>(self, other: V) -> Self { ... } fn dist<V: Vector2<Scalar = Self::Scalar>>(self, to: V) -> Self::Scalar { ... } fn mag(self) -> Self::Scalar { ... } fn rotate_about<V: Vector2<Scalar = Self::Scalar> + Clone>(
        self,
        pivot: V,
        radians: Self::Scalar
    ) -> Self { ... }
}
Expand description

Trait for manipulating 2D vectors

Required Associated Types

The scalar type

Required Methods

Get the x component

Get the y component

Create a new vector from an x and y component

Provided Methods

Map this vector to a vector of another type

Negate the vector

Add the vector to another

Subtract another vector from this one

Multiply this vector by a scalar

Multiply this vector component-wise by another

Divide this vector by a scalar

Divide this vector component-wise by another

Get the distance between this vector and another

Get the vector’s magnitude

Rotate the vector some number of radians about a pivot

Implementors