From 415a3cad7baf286c3523dea6864dd283b46c5328 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 9 Dec 2022 11:01:24 +0100 Subject: [PATCH] :sparkles: Calculate selrect from points --- common/src/app/common/geom/shapes/points.cljc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/common/src/app/common/geom/shapes/points.cljc b/common/src/app/common/geom/shapes/points.cljc index f8ea54369..dba17591e 100644 --- a/common/src/app/common/geom/shapes/points.cljc +++ b/common/src/app/common/geom/shapes/points.cljc @@ -7,7 +7,9 @@ (ns app.common.geom.shapes.points (:require [app.common.geom.point :as gpt] + [app.common.geom.shapes.common :as gco] [app.common.geom.shapes.intersect :as gsi] + [app.common.geom.shapes.rect :as gre] [app.common.math :as mth])) (defn origin @@ -134,3 +136,10 @@ (defn merge-parent-coords-bounds [bounds parent-bounds] (parent-coords-bounds (flatten bounds) parent-bounds)) + +(defn points->selrect + [points] + (let [width (width-points points) + height (height-points points) + center (gco/center-points points)] + (gre/center->selrect center width height)))