Refraction, reflection and a triangle: why the ray bends, how long it takes and where it comes out again