Ziggarautomatic

I recently learned that VRML worlds which contain ziggaruts are in general better than those that don't. So I wrote a little CGI script, hosted here, to generate them on-demand.

First of all, I acknowledge that I am misusing the term Ziggarut. To start with, real Babylonian ziggaruts were square, and there were ordinary stairways from one level to the next; none of this wrap-around stuff.

The ziggarut (OK, let's just call it a tower) has the following parameters:

Geometric Parameters

Top Radius (A)
The tower has a round top; this gives its radius.
Plank Width (B), Plank Height (C)
The tower's sides are constructed of planks whose width and height are given here. The narrower the width, the finer the detail, but the larger the number of polygons. The plank height is also the vertical distance between turns of the path going up the tower's side. Thus, if the Plank Height is much smaller than the Height, there will be lots of turns of the spiral.
Path Width (D)
A path climbs to the top of the tower, winding around the side. This specifies its width.
Height (E)
The tower will be drawn with the center of its base at (0,0,0), the center of the top is thus at (0,Height,0).

Decorative Parameters

Side Colors
A list of triples, each triple expressing a VRML RGB color as three numbers; for example, blue would be [0.0, 0.0, 1.0]. The planks will each be painted one of the colors in the list, selected at random. Of course, if there is only one color in the list, the tower will be monochrome.
Ramp Colors
Similarly, a list of triples, that are used to paint the triangles that tile the ramp to the top.
Top Texture
The URL of a graphics file that will be used to decorate the circular top of the tower. If not provided, the top will be painted green [0, 1.0, 0].

How It's Done

It's a perl script, 400+ lines in length, that does a whole bunch of elementary trigonometry. I don't think this kind of a tower can be drawn with fewer polygons. It should be done with a VRML prototype/extension, except for I haven't figured out how to do that. This would be good because even though the towers render efficiently, their ASCII representation gets very large. Eventually I'll make the code open-source, but not until I make up my mind what language it wants to be in, and also added some options (what's the point of a tower without a treasure chamber?)