The results pattern of the ray casting algorithm should be stored so that it does not need to be recalculated at every timestep.