diff options
author | natrixaeria <janng@gmx.de> | 2019-06-02 14:59:09 +0200 |
---|---|---|
committer | natrixaeria <janng@gmx.de> | 2019-06-02 14:59:09 +0200 |
commit | 0835c281ed1c6bdccca2412b71a8bdec4d03a620 (patch) | |
tree | 681f32d6bccf35293c61732a65c305df6e14747c /game_server/src/maths.rs | |
parent | 8bc245b8ca099a4c929562677d83aa11122dffd0 (diff) | |
parent | 7d0f3cf2bec7a248aed699805542ad235e354753 (diff) |
Merge branch 'webhogg' of https://github.com/TrueDoctor/DiscoBot into webhogg
Diffstat (limited to 'game_server/src/maths.rs')
-rw-r--r-- | game_server/src/maths.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/game_server/src/maths.rs b/game_server/src/maths.rs index cc6c777..7c4ee2f 100644 --- a/game_server/src/maths.rs +++ b/game_server/src/maths.rs @@ -53,11 +53,32 @@ impl std::ops::Mul<f32> for Vec2 { fn mul(self, scale: f32) -> Self { Self { x: self.x * scale, - y: -self.y * scale + y: self.y * scale } } } +impl std::ops::Div<f32> for Vec2 { + type Output = Self; + fn div(self, scale: f32) -> Self { + Self { + x: self.x / scale, + y: self.y / scale + } + } +} + +impl std::ops::Div<Vec2> for Vec2 { + type Output = Self; + fn div(self, scale: Vec2) -> Self { + Self { + x: self.x / scale.x, + y: self.y / scale.y + } + } +} + + impl std::cmp::PartialOrd for Vec2 { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { if self.x <= other.x && self.y <= other.y { |