rust/integral-geometry/src/lib.rs
changeset 14031 c47283feafac
parent 13950 48796bef9e69
child 14032 2869c2ccb1b8
--- a/rust/integral-geometry/src/lib.rs	Tue Oct 30 02:14:00 2018 +0300
+++ b/rust/integral-geometry/src/lib.rs	Tue Oct 30 05:55:58 2018 +0300
@@ -37,6 +37,12 @@
     pub fn max_norm(self) -> i32 {
         std::cmp::max(self.x.abs(), self.y.abs())
     }
+
+    #[inline]
+    pub fn transform(self, matrix: &[i32; 4]) -> Self {
+        Point::new(matrix[0] * self.x + matrix[1] * self.y,
+                   matrix[2] * self.x + matrix[3] * self.y)
+    }
 }
 
 macro_rules! bin_op_impl {