Add vec.rs

This commit is contained in:
Nicolas 2022-04-02 17:23:19 +02:00
parent c193d5897a
commit 57bbb6e9a7

15
src/vec.rs Normal file
View File

@ -0,0 +1,15 @@
#[derive(Copy, Clone)]
pub struct Vector {
pub x: f32,
pub y: f32
}
impl Vector {
pub fn new(x: f32, y: f32) -> Self {
Self { x, y }
}
pub fn from_terminal(x: usize, y: usize) -> Self {
Vector::new(x as f32, y as f32 * 2.0)
}
}