aboutsummaryrefslogtreecommitdiff
path: root/evc/src/helpers/vector.rs
diff options
context:
space:
mode:
Diffstat (limited to 'evc/src/helpers/vector.rs')
-rw-r--r--evc/src/helpers/vector.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/evc/src/helpers/vector.rs b/evc/src/helpers/vector.rs
index 12243e4..f411832 100644
--- a/evc/src/helpers/vector.rs
+++ b/evc/src/helpers/vector.rs
@@ -24,6 +24,15 @@ impl<T: std::ops::Div<Output = T> + Copy> Vec2<T> {
}
}
+impl<T: std::ops::Mul<Output = T> + Copy> Vec2<T> {
+ pub fn scale(&self, f: T) -> Self {
+ Self {
+ x: self.x * f,
+ y: self.y * f,
+ }
+ }
+}
+
impl Vec2<isize> {
pub fn x_only(&self) -> Self {
Self { x: self.x, y: 0 }