NINA (spirograph-like drawings) in PostScript

My colleague, Matt Freedman, wrote an impressive spirograph-like line-drawing program in Java he calls NINA. The webpage for NINA gives the remarkably short underlying line-drawing algorithm:

	num_lines = some number
	a_pulse = some number less than num_lines
	b_pulse = some number less than num_lines
	for (count = 0; count < num_lines; count++) {
	  cur_x = cos((-2*PI*a_pulse*count)/num_lines) +
	  cur_y = sin((-2*PI*a_pulse*count)/num_lines) +
	  draw line from (prev_x, prev_y) to (cur_x, cur_y)
which I translated into PostScript:
	%!PS-Adobe-2.0 EPSF-1.2
	%%BoundingBox: 10 100 605 695
	%%Creator: Corey Satten inspired by Matt Freedman
	/num_lines 825 def
	/a_pulse 106.3353 def
	/b_pulse 745.381145 def
	72 8.5 mul 2 div 11 72 mul 2 div translate
	72 2 mul dup scale 0 setlinewidth
	2 0 moveto
	1 1 num_lines {
	/count exch def
	/cur_x -360 a_pulse mul count mul num_lines div cos
	       -360 b_pulse mul count mul num_lines div cos add def
	/cur_y -360 a_pulse mul count mul num_lines div sin
	       -360 b_pulse mul count mul num_lines div sin add def
	cur_x cur_y lineto
	} for
	stroke grestore
Below are eight example NINAs (as low-resolution bitmaps) which will yield the "encapsulated" PostScript source if you click on them. This encapsulated PostScript can be printed asis, or can be imported into documents by many programs which know how to import images. Unlike GIF, JPEG, or TIFF image files; encapsulated PostScript files will print/display at the full resolution of the output device (however you must have PostScript software in your printer or computer to print or display them at all).

Matt uses only integer values for a_pulse and b_pulse. If you look in his gallery of pictures you will find many pretty images but none like the first three or last four below. (For the last four, I changed Matt's algorithm too.)

[image] 13.eps
[image] 48.eps
[image] 06.eps
[image] 14.eps
[image] 104.eps
[image] 109.eps
[image] 105.eps
[image] 106.eps