Improved tests for geom transforms

This commit is contained in:
alonso.torres
2020-12-02 12:49:49 +01:00
committed by Andrey Antukh
parent 8bc37416a0
commit 1fb5ffb59b
5 changed files with 279 additions and 85 deletions

View File

@@ -102,7 +102,6 @@
(let [calc-extremities
(fn [command prev]
(case (:command command)
:close-path []
:move-to [(command->point command)]
;; If it's a line we add the beginning point and endpoint
@@ -116,7 +115,8 @@
(curve-extremities (command->point prev)
(command->point command)
(command->point command :c1)
(command->point command :c2)))))
(command->point command :c2)))
[]))
extremities (mapcat calc-extremities
content

View File

@@ -13,6 +13,10 @@
[app.common.geom.shapes.common :as gco]))
(defn rect->points [{:keys [x y width height]}]
(assert (number? x))
(assert (number? y))
(assert (and (number? width) (> width 0)))
(assert (and (number? height) (> height 0)))
[(gpt/point x y)
(gpt/point (+ x width) y)
(gpt/point (+ x width) (+ y height))