mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 18:11:37 +02:00
🎉 Improved transformations
This commit is contained in:
parent
d050103f58
commit
b73958efd0
21 changed files with 1257 additions and 1017 deletions
|
@ -9,13 +9,17 @@
|
|||
|
||||
(ns uxbox.util.geom.point
|
||||
(:refer-clojure :exclude [divide])
|
||||
(:require [uxbox.util.math :as mth]
|
||||
[cognitect.transit :as t]))
|
||||
(:require
|
||||
[cuerdas.core :as str]
|
||||
[uxbox.util.math :as mth]
|
||||
[cognitect.transit :as t]))
|
||||
|
||||
;; --- Point Impl
|
||||
|
||||
(defrecord Point [x y])
|
||||
|
||||
(defn s [{:keys [x y]}] (str "(" x "," y ")"))
|
||||
|
||||
(defn ^boolean point?
|
||||
"Return true if `v` is Point instance."
|
||||
[v]
|
||||
|
@ -71,6 +75,11 @@
|
|||
(assert (point? other))
|
||||
(Point. (/ x ox) (/ y oy)))
|
||||
|
||||
(defn inverse
|
||||
[{:keys [x y] :as p}]
|
||||
(assert (point? p))
|
||||
(Point. (/ 1 x) (/ 1 y)))
|
||||
|
||||
(defn negate
|
||||
[{x :x y :y :as p}]
|
||||
(assert (point? p))
|
||||
|
@ -161,3 +170,4 @@
|
|||
(t/read-handler
|
||||
(fn [value]
|
||||
(map->Point value))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue