diff options
author | metamuffin <metamuffin@disroot.org> | 2022-12-07 21:23:42 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2022-12-07 21:23:42 +0100 |
commit | 2ac18802b58d671c10538e78d50a620baad9a188 (patch) | |
tree | 17f924039fd8f3dae2801902d4bdeaac8ea74624 /evc/src/helpers/vector.rs | |
parent | 9d7986bbfd44b69a623fa29528b5d13000b91c77 (diff) | |
download | video-codec-experiments-2ac18802b58d671c10538e78d50a620baad9a188.tar video-codec-experiments-2ac18802b58d671c10538e78d50a620baad9a188.tar.bz2 video-codec-experiments-2ac18802b58d671c10538e78d50a620baad9a188.tar.zst |
advanced transform
Diffstat (limited to 'evc/src/helpers/vector.rs')
-rw-r--r-- | evc/src/helpers/vector.rs | 9 |
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 } |