3It is an interesting exercise to derive these formulas for the coordinates. Think of tessellating the plane with an infinite number of billiard tables by starting with the original table and then reflecting it across its sides. In this “unfolded” world, a billiard trajectory is a straight line given by (vxt + h, vyt + k). Reducing the coordinates modulo 2 will translate the ball into one of the four tables in [0, 2] × [0, 2], where the absolute value function can now be used to accomplish the reflection.

Get Mathematica DeMYSTiFied now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.