From 5fd1e7f0309ae87d42457e0670aeb409ab3a729b Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 12 Aug 2016 20:39:31 +0300 Subject: [PATCH] Add transform point function. Will be used for path edition. --- src/uxbox/main/geom/point.cljs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/uxbox/main/geom/point.cljs b/src/uxbox/main/geom/point.cljs index c9dce89b8..5e4862799 100644 --- a/src/uxbox/main/geom/point.cljs +++ b/src/uxbox/main/geom/point.cljs @@ -158,3 +158,11 @@ [{:keys [x y]} decimanls] (Point. (mth/precision x decimanls) (mth/precision y decimanls))) + + +(defn transform + "Transform a point applying a matrix transfomation." + [{:keys [x y] :as p} {:keys [a b c d tx ty] :as m}] + (Point. (+ (* x a) (* y c) tx) + (+ (* x b) (* y d) ty))) +