mirror of
https://github.com/penpot/penpot.git
synced 2025-03-11 07:11:32 -05:00
Add math utils namespace.
This commit is contained in:
parent
4c84fd46da
commit
1725f51818
1 changed files with 33 additions and 0 deletions
33
src/uxbox/math.cljs
Normal file
33
src/uxbox/math.cljs
Normal file
|
@ -0,0 +1,33 @@
|
|||
(ns uxbox.math
|
||||
"A collection of math utils."
|
||||
(:require [goog.math :as math]))
|
||||
|
||||
(defn sin
|
||||
"Returns the sine of a number"
|
||||
[^number v]
|
||||
(js/Math.sin v))
|
||||
|
||||
(defn cos
|
||||
"Returns the cosine of a number."
|
||||
[^number v]
|
||||
(js/Math.cos v))
|
||||
|
||||
(defn tan
|
||||
"Returns the tangent of a number."
|
||||
[^number v]
|
||||
(js/Math.tan v))
|
||||
|
||||
(defn neg
|
||||
"Negate the number"
|
||||
[^number v]
|
||||
(- v))
|
||||
|
||||
(defn radiants
|
||||
"Converts degrees to radians."
|
||||
[^number degrees]
|
||||
(math/toRadians degrees))
|
||||
|
||||
(defn degrees
|
||||
"Converts radians to degrees."
|
||||
[^number radiants]
|
||||
(math/toDegrees radiants))
|
Loading…
Add table
Reference in a new issue