Skip to main content

Vector

Type Alias Vector 

Source
pub type Vector = Vector2D<f64, DrawingSpace>;
Expand description

A 2D vector for working in DrawingSpace.

Aliased Type§

pub struct Vector {
    pub x: f64,
    pub y: f64,
}

Fields§

§x: f64§y: f64

Trait Implementations§

Source§

impl Length for Vector

Source§

fn length(&self) -> f64

Calculates the Vector’s magnitude.

let vector = Vector::new(3.0, 4.0);

assert_eq!(vector.length(), 5.0);