to01 function

Helper function to scale from [min,max] to [0,1]