From 2838ea5f328e3c199dde71b687807a5c3cb01033 Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Fri, 29 Oct 2021 18:34:42 +0100 Subject: [PATCH] add more maths --- agb/src/number.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/agb/src/number.rs b/agb/src/number.rs index f046e79d..0032d43e 100644 --- a/agb/src/number.rs +++ b/agb/src/number.rs @@ -720,6 +720,18 @@ impl Vector2D { pub fn get(self) -> (T, T) { (self.x, self.y) } + pub fn hadamard(self, other: Self) -> Self { + Self { + x: self.x * other.x, + y: self.y * other.y, + } + } + pub fn swap(self) -> Self { + Self { + x: self.y, + y: self.x, + } + } } #[test_case]