function Util.normalize(M,v,s,k,N)if k==nil then k=0 end if N==nil then N=1 end local b=((s-k)/(N-k))*(v-M)+M return b end function Util.denormalize(M,v,s)return s*(v-M)+M end function Util.invertValue(M,v,s)return(v-M)+s end

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
