MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for software that will give billiard trajectories in arbitrary plane polygons. After much work I was able to produce this figure.

alt text

It was a good exercise, but at this point I wonder if scripts already exist.

I've heard if the angles are rational multiples of pi you can unfold the polygon so the billiard flow in the polygon becomes the geodesic flow on a translation surface.

share|cite|improve this question
It's not quite what you want, but you might be interested in McBilliards : – Andy Putman Aug 3 '10 at 3:32
Richard Schwartz (webpage here : ) has done an enormous amount of computer-aided investigations of billiards. You might want to look at his webpage and possibly contact him -- he would certainly know if anything like this exists. – Andy Putman Aug 3 '10 at 3:37
On top of what Andy says, let me add that Rich is extremely amiable and helpful, and you shouldn't hesitate to contact him. :) – David Hansen Aug 3 '10 at 3:53
Like many others, I also have implemented billiards programs, but my code is ad hoc rather than a general script. I would like to offer one caveat: it is challenging to control the numerical errors. After a large number of reflections, the results can easily become random nonsense. – Joseph O'Rourke Aug 3 '10 at 12:26
@John Mangual: It depends on what you seek to learn from your simulation. A billiard ball shot off at a rational multiple of $\pi$ angle behaves rather differently than does one shot at an irrational angle. And with standard computer arithmetic, your billiards are all shot at rational angles. If either what you care about does not depend on the rational/irrational distinction, or you don't run your simulation long enough to reach the end of your bit precision, then numerical issues are not relevant. Otherwise they are. – Joseph O'Rourke Aug 3 '10 at 16:22

You might find The Billiards Simulation useful. It seems to be a student project aimed at helping people visualize a chaotic dynamical system.

This is not an exact answer to your question. The program described at handles regular polygons, circles, ellipses, and "stadiums" (half-circles joined by straight lines), and not arbitrary plane polygons which you are looking for. You might want to contact the authors for additional information.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.