0
Fork 0
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:
Andrey Antukh 2016-01-17 23:27:44 +02:00
parent 4c84fd46da
commit 1725f51818

33
src/uxbox/math.cljs Normal file
View 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))