%!PS % Draw a spiral of squares % Illustrates: for-loop, rotate, translate, scale. % Joseph O'Rourke 3 setlinewidth 1 0 0 setrgbcolor /inch {72 mul} def 4.25 inch 5.5 inch translate 0.25 0.25 scale % Draw a 1x1 square, lower left corner at origin /square { newpath 0 0 moveto 1 inch 0 lineto 1 inch 1 inch lineto 0 1 inch lineto closepath stroke } def % Draw n squares /n 24 def gsave 1 1 n { % bind loop variable to x /x exch def square 30 rotate 0 x 10 mul translate 1.1 1.1 scale } for grestore % circle the origin 0 0 1 setrgbcolor 0 0 20 0 360 arc stroke showpage