the bending of waves as they pass from one medium into another