» A Little Processing #

Paul R. Brown @ 2009-02-24

I wanted a visual representation of the usual continued fraction expansion of the irrational number e that used concentric rings to represent the successive anapests of the tail of the expansion; with grouping added for emphasis:

2, 1,1,2, 1,1,4, 1,1,6, ...

The first ring would have four sectors; the second would have six, the third eight, etc. Something like this:

The question was how to get it drawn, and after a little thought, I settled on writing a Processing program to generate the image. The language doesn't include a primitive for drawing sectors, but it's possible to represent a second as a larger filled arc and then a smaller filled arc that covers the same angle but filled with background color:

fill(foreground);
arc(x0,y0,r1,r1,theta0,theta1);
fill(background);
arc(x0,y0,r0,r0,theta0,theta1);

Or, in my case, just stacking up pie charts with the smallest on top is sufficient. The source is here.

 

← 2009-02-02 — What Chess Club Should Teach You About Pitching
→ 2009-02-24 — Up to What I Am