why light gets refract in denser medium