 ######################################################
 # MATH FUNCTIONS
 
-Utils.round = (value, decimals=0) ->
-	d = Math.pow 10, decimals
-	Math.round(value * d) / d
+Utils.round = (value, decimals=0, increment=null, min=null, max=null) ->
+	
+	d = Math.pow(10, decimals)
+	
+	value = Math.round(value / increment) * increment if increment
+	value = Math.round(value * d) / d
+
+	return min if min and value < min
+	return max if max and value > max
+	return value
 
 Utils.clamp = (value, a, b) ->
 

Utils.randomNumber = (a=0, b=1) ->
	# Return a random number between a and b
	Utils.mapRange Math.random(), 0, 1, a, b

Utils.defineEnum = (names = [], offset = 0, geometric = 0) ->
	Enum = {}

	(/safari/).test(navigator.userAgent.toLowerCase())

Utils.isTouch = ->
	window.ontouchstart is null and
	window.ontouchmove is null and
	window.ontouchend is null
