OSLArchemedes Spiral

Introduction

For a point to be located on an Archemedian spiral it's distance from the center of
the spiral (R) must be the same as some percentage (coeff) of it's rotational angle
(theta) around the center of the spiral ie.

R = coeff * theta

Naively, it might be considered that all a shader has to do is,
- convert the s,t location of the point being shaded to polar coordinates,
- set a value for coeff,
If the angle of rotation (theta) multiplied by the coeff matches it's radial distance (R)
to within a small margin of error
then colorize the micro-polygon, say black, otherwise set it to a background color.

Figure 1 shows that this naive approach, listing 1, does not work. The spiral terminates
after it's first "turn" - the black line should continue along the full spiral shown in blue.

Clearly what the shader fails to take into account is the number of turns or
cycles of the spiral. In other words the rotational angle calculated by the conversion
to polar coordinates only goes from 0 to 2PI (0 to 360 degrees) when the angle should
go from zero to 2PI * turns, say, 0 to 1080 degrees!

Listing 2 provides the code for a shader that will draw a full spiral. However,
becuase of the simple antialiasing that it uses, the "blur"
parameter may need to be adjusted in order to avoid the rendering artifacts shown
on the right of
figure 2.