implemented calculateRefraction