Fixed 1D linear scaling and added clamps and a better offset to nearest neighbor scaling