Trait VectorOperations

Source
pub trait VectorOperations<T> {
    // Required methods
    fn length(&self) -> f64;
    fn normalize(&self) -> Vec2<f64>;
    fn dot(&self, rhs: &Self) -> T;
}
Expand description

Common operations on vectors.

Required Methods§

Source

fn length(&self) -> f64

Get the length of this vector.

Source

fn normalize(&self) -> Vec2<f64>

Normalize this vector (i.e., set its length to 1 but preserve the direction).

Source

fn dot(&self, rhs: &Self) -> T

Calculate the dot product of this vectort and another one.

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§