diff --git a/src/uxbox/math.cljs b/src/uxbox/math.cljs new file mode 100644 index 000000000..d073fdc73 --- /dev/null +++ b/src/uxbox/math.cljs @@ -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))