Polyglot 7: POV-Ray
25 September 2004
Seventh is POV-Ray. Whenever a program proudly claims to be "Turing complete" one knows right away that it's going to be a nightmare to use. Difference engines, dominoes and mousetraps with ping-pong balls are Turing complete, but actually doing something useful with them is another matter. Thus it was with some trepidation that I started working on a POV-Ray version of the colours program.
POV-Ray turned out to be the easiest implementation yet. The language is strong, the graphics are great, but most importantly the documentation seems to be psychic. I really don't know what else to call it. Every time I had a problem and typed something into the help, the answer was right there - complete with an example. It's even better than PHP's docs. Looking at POV-Ray's documentation objectively, I can't see anything special. It's just really well written. And that makes it a dream to use.
Here's the POV-Ray source code and a sample output. Rendering only takes a few seconds, but because POV-Ray uses macros instead of functions it means that five minutes are spent unrolling the recursive algorithm.
Once POV-Ray could generate 2D images, it was trivial to switch out of orthogonal mode, scale the pixels based on their colour, and render the scene in 3D. This is what I had in mind when I originally came up with the algorithm in 2000. At the time I was walking with Bess through the Scottish hills, and pondering how to generate the topology. It's taken four years to find a way to visualise it; looks good. I can see my house from here!
Update: Here's an unrelated rendering; I'm amused that the magnifying glass is powerful enough to start revealing individual pixels of the underlying image.