From 57bbb6e9a7898fd23f7a477280e3fe98b0e184a7 Mon Sep 17 00:00:00 2001 From: Nicolas <> Date: Sat, 2 Apr 2022 17:23:19 +0200 Subject: [PATCH] Add vec.rs --- src/vec.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/vec.rs diff --git a/src/vec.rs b/src/vec.rs new file mode 100644 index 0000000..2a0170b --- /dev/null +++ b/src/vec.rs @@ -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) + } +} \ No newline at end of file