summaryrefslogtreecommitdiff
path: root/game_server/src/maths.rs
diff options
context:
space:
mode:
authornatrixaeria <janng@gmx.de>2019-06-02 14:59:09 +0200
committernatrixaeria <janng@gmx.de>2019-06-02 14:59:09 +0200
commit0835c281ed1c6bdccca2412b71a8bdec4d03a620 (patch)
tree681f32d6bccf35293c61732a65c305df6e14747c /game_server/src/maths.rs
parent8bc245b8ca099a4c929562677d83aa11122dffd0 (diff)
parent7d0f3cf2bec7a248aed699805542ad235e354753 (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.rs23
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 {