This sketch properly belongs to Jared Tarbell. Calculations have been optimized for the latest version of Processing, however.