function Util.normalize(d,R,v,b,x)if b==nil then b=0 end if x==nil then x=1 end local i=((v-b)/(x-b))*(R-d)+d return i end function Util.denormalize(d,R,v)return v*(R-d)+d end function Util.invertValue(d,R,v)return(R-d)+v end
--Math
function Util.normalize(normMin, normMax, value, realMin, realMax)
	if realMin == nil then
		realMin = 0
	end
	if realMax == nil then
		realMax = 1
	end
	local value = (value - realMin) / (realMax - realMin) * (normMax - normMin) + normMin
	return value
end

function Util.denormalize(min, max, value)
	return (value * (max - min) + min)
end

function Util.invertValue(value, largestValue, smallestValue)
	return (largestValue - value) + smallestValue
end
