Translation of http://www.playfuljs.com/physics-for-the-lazy/ into Swift