the important change is the last hunk.We store coords[i] in the local variable coord, then we apply the clamping to coord, but then ...we use coords[i] as input for the normalization, so the clamping is lost.That is what my patch changes.