calculate traveltime when tracing rays