From 23d6c2d3b56145999c14596733853bc6de49eff3 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 30 Dec 2022 19:25:28 +0100 Subject: fixed: linear transform, value scale and command line ars --- evc/src/helpers/matrix.rs | 4 ++-- evc/src/helpers/vector.rs | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'evc/src/helpers') diff --git a/evc/src/helpers/matrix.rs b/evc/src/helpers/matrix.rs index c3c120b..0007440 100644 --- a/evc/src/helpers/matrix.rs +++ b/evc/src/helpers/matrix.rs @@ -12,8 +12,8 @@ impl + std::ops::Add + Copy> Mat2 { #[inline] pub fn transform(&self, v: Vec2) -> Vec2 { Vec2 { - x: self.a * v.x + self.b * v.x, - y: self.c * v.y + self.d * v.y, + x: self.a * v.x + self.b * v.y, + y: self.c * v.x + self.d * v.y, } } } diff --git a/evc/src/helpers/vector.rs b/evc/src/helpers/vector.rs index 0209c58..a4766d1 100644 --- a/evc/src/helpers/vector.rs +++ b/evc/src/helpers/vector.rs @@ -20,6 +20,14 @@ impl From> for Vec2 { } } } +impl From> for Vec2 { + fn from(value: Vec2) -> Self { + Self { + x: value.x as isize, + y: value.y as isize, + } + } +} impl Vec2 { pub const ZERO: Vec2 = Vec2 { x: 0, y: 0 }; @@ -58,7 +66,7 @@ impl Vec2 { Self { x: self.x, y: 0 } } pub fn y_only(&self) -> Self { - Self { x: self.x, y: 0 } + Self { x: 0, y: self.y } } } -- cgit v1.2.3-70-g09d2