// csr_main.c// CSR stands for Circular Slide Rule. This C program generates PostScript// for the fiducial markings on a precision circular slide rule.//// C. Kankelborg, 1997/03/17#include <stdio.h>#include <stdlib.h>#include <time.h>#include <math.h>#define R 1.5		// scale radius#define R2 (1.5 - 0.3)		// secondary scale radius#define R3 (1.5 - 0.3 - 0.3) // tertiary scale radius#define TLA 0.1875	// ticklengths, longest to shortest#define TLB 0.125#define TLC 0.0625#define XC 2.3		// position of disc center#define YC 3.0#define PI 3.1415927#define E (exp(1))#define FSIZE 6		// point size of fontvoid drawheading(text,outfile) // heading of up to 128 characterschar text[128];FILE *outfile;{	extern void drawlabel();	drawlabel(text, R+TLA+((float)FSIZE/72.0)+0.125, 0.0, outfile);}void drawtick(r1,r2,theta,outfile) // draw a radial linedouble r1, r2, theta;FILE *outfile;{	double x1, y1, x2, y2;	theta = -theta; // make the slide rule clockwise rather than counter	x1 = r1*cos(theta) + XC;	y1 = r1*sin(theta) + YC;	x2 = r2*cos(theta) + XC;	y2 = r2*sin(theta) + YC;		fprintf(outfile, "newpath\n");	fprintf(outfile, "%f inch %f inch moveto\n", x1, y1);	fprintf(outfile, "%f inch %f inch lineto\n", x2, y2);	fprintf(outfile, "stroke\n");}void drawlabel(text,r,theta,outfile) // place text centered at (x,y), with rotationchar text[128];double r,theta; // x,y are in inches; theta in radiansFILE *outfile;{	double x,y,deg;	theta = -theta; // make the slide rule clockwise rather than counter	deg = (theta * 180.0/PI)-90.0;	x = r*cos(theta) + XC;	y = r*sin(theta) + YC;		fprintf(outfile,"newpath\n");	fprintf(outfile,"gsave\n");	fprintf(outfile,"%f inch %f inch moveto\n",x,y);	fprintf(outfile,"%f rotate\n",deg);	fprintf(outfile,"(%s) stringwidth\n",text);	fprintf(outfile,"pop 2.0 div neg 0.0  %% dx dy -> -dx/2 0.0\n");	fprintf(outfile,"rmoveto\n");	fprintf(outfile,"(%s) show\n",text);	fprintf(outfile,"grestore\n");}void main(void) {	double theta, sinphi, expx;	char label[32];	int i,j,k;	FILE *outfile;		printf("Circular Slide Rule\n\n");	printf("Generating PostScript output (csr_1of2.ps, csr_2of2.ps)...\n\n\n\n\n");		outfile = fopen("csr_1of2.ps","w");	fprintf(outfile, "%%!\n");	fprintf(outfile, "%% PostScript pattern for a precision circular slide rule, part 1\n");	fprintf(outfile, "%% Copyright (C) 1997 by Charles C. Kankelborg\n");	fprintf(outfile, "%% This PostScript program may be freely distributed for noncommercial\n");	fprintf(outfile, "%% use, as long as the accompanying copyright notice remains intact.\n");	fprintf(outfile, "%% No warranty. Use at your own risk.\n");	fprintf(outfile, "/inch {72 mul} def	%% Convert inches->points (1/72 inch)\n");	fprintf(outfile, "0 setlinewidth  %% hairline\n");	fprintf(outfile, "/Times-Roman findfont   %% Get the basic font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n\n");		fprintf(outfile,"newpath\n");	fprintf(outfile,"%f inch %f inch moveto\n",0.5, 0.5);	fprintf(outfile,"(CIRCULAR SLIDE RULE) show\n");	fprintf(outfile,"%f inch %f inch moveto\n",4.25, 0.5);	fprintf(outfile,"(Copyright \(C\) 1997 by Charles C. Kankelborg) show\n");		//SIDE 1: OUTER MULTIPLICATION SCALE	fprintf(outfile, "%% SIDE 1: OUTER MULTIPLICATION SCALE\n");	fprintf(outfile, "gsave\n");	fprintf(outfile, "0 inch 5.0 inch translate\n");		fprintf(outfile, "newpath                 %% Begin crosshairs at center\n");	fprintf(outfile, "%f inch %f inch moveto\n",XC,YC-TLA);	fprintf(outfile, "%f inch %f inch lineto\n",XC,YC+TLA);	fprintf(outfile, "stroke\n");	fprintf(outfile, "newpath\n");	fprintf(outfile, "%f inch %f inch moveto\n",XC-TLA,YC);	fprintf(outfile, "%f inch %f inch lineto\n",XC+TLA,YC);	fprintf(outfile, "stroke\n");	fprintf(outfile, "\n");		drawheading("SIDE 1: OUTER MULTIPLICATION SCALE",outfile);		for(i=1; i < 10; i++) { // Big ticks (size A)		theta = log10((double)i)*2.0*PI;		drawtick(R, R+TLA, theta, outfile);		sprintf(label,"%d",i);		drawlabel(label,R+TLA,theta,outfile);		for(j=0; j < 10; j++) { // 1/10 ticks (size B)			theta = log10((double)i+((double)j)/10.0)*2.0*PI;			drawtick(R, R+((j==5) ? TLA : TLB), theta, outfile);			if(i == 1) { // Don't label if too close together.				if(j > 0) {					sprintf(label,"%d.%d",i,j);					drawlabel(label,R+TLB,theta,outfile);				}				for(k=1; k < 10; k++) {					theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;					drawtick(R, R+((k==5) ? TLB : TLC), theta, outfile);				}			} else if(i <= 4) {				for(k=2; k < 10; k=k+2) {					theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;					drawtick(R, R+TLC, theta, outfile);				}			} else if(i <= 9) {				k=5;				theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;				drawtick(R, R+TLC, theta, outfile);			}		}	}	theta = log10(E)*2.0*PI; // e label	drawtick(R, R+TLA, theta, outfile);	drawlabel("e",R+TLA,theta,outfile);		theta = log10(PI)*2.0*PI; // pi label	fprintf(outfile, "/Symbol findfont        %% Get the symbol font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n");	drawtick(R, R+TLA, theta, outfile);	drawlabel("p",R+TLA,theta,outfile);	fprintf(outfile, "/Times-Roman findfont   %% Get back the basic font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n");		//SIDE 1: INNER MULTIPLICATION SCALE and TRIG SCALE	fprintf(outfile, "%% SIDE 1: INNER MULTIPLICATION SCALE\n");	fprintf(outfile, "gsave\n");	fprintf(outfile, "3.75 inch 0 inch translate\n");		fprintf(outfile, "newpath                 %% Begin crosshairs at center\n");	fprintf(outfile, "%f inch %f inch moveto\n",XC,YC-TLA);	fprintf(outfile, "%f inch %f inch lineto\n",XC,YC+TLA);	fprintf(outfile, "stroke\n");	fprintf(outfile, "newpath\n");	fprintf(outfile, "%f inch %f inch moveto\n",XC-TLA,YC);	fprintf(outfile, "%f inch %f inch lineto\n",XC+TLA,YC);	fprintf(outfile, "stroke\n");	fprintf(outfile, "\n");		drawheading("SIDE 1: INNER MULTIPLICATION SCALE and TRIG SCALE",outfile);	//INNER MULTIPLICATION SCALE	for(i=1; i < 10; i++) { // Big ticks (size A)		theta = log10((double)i)*2.0*PI;		drawtick(R, R-TLA, theta, outfile);		sprintf(label,"%d",i);		drawlabel(label,R-TLA-((double)FSIZE/72.0),theta,outfile);		for(j=0; j < 10; j++) { // 1/10 ticks (size B)			theta = log10((double)i+((double)j)/10.0)*2.0*PI;			drawtick(R, R-((j==5) ? TLA : TLB), theta, outfile);			if(i == 1) { // Don't label if too close together.				if(j > 0) {					sprintf(label,"%d.%d",i,j);					drawlabel(label,R-TLB-((double)FSIZE/72.0),theta,outfile);				}				for(k=1; k < 10; k++) {					theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;					drawtick(R, R-((k==5) ? TLB : TLC), theta, outfile);				}			} else if(i <= 4) {				for(k=2; k < 10; k=k+2) {					theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;					drawtick(R, R-TLC, theta, outfile);				}			} else if(i <= 9) {				k=5;				theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;				drawtick(R, R-TLC, theta, outfile);			}		}	}	theta = log10(E)*2.0*PI; // e label	drawtick(R, R-TLA, theta, outfile);	drawlabel("e",R-TLA-((double)FSIZE/72.0),theta,outfile);		theta = log10(PI)*2.0*PI; // pi label	fprintf(outfile, "/Symbol findfont        %% Get the symbol font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n");	drawtick(R, R-TLA, theta, outfile);	drawlabel("p",R-TLA-((double)FSIZE/72.0),theta,outfile);	fprintf(outfile, "/Times-Roman findfont   %% Get back the basic font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n");		//TRIG SCALE	for(i = 2; i <= 15; i++) { // i = phi(radians)*10		sinphi = sin((double)i/10.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-TLA,theta,outfile);		if((i != 12) && (i != 14) && (i != 15)) { // keep labels from crowding			sprintf(label,"%.1f",(double)i/10.0);			drawlabel(label,R2-TLA-((double)FSIZE/72.0),theta,outfile);		}	}		for(j = 11; j <= 70; j++) { // j = phi(radians)*100		sinphi = sin((double)j/100.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-TLB,theta,outfile);		if(j <= 19) {			sprintf(label,".%d",j);			drawlabel(label,R2-TLB-((double)FSIZE/72.0),theta,outfile);		}	}	for(j = 71; j <= 110; j++) { // j = phi(radians)*100		sinphi = sin((double)j/100.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-TLC,theta,outfile);	}	for(j = 25; j <= 110; j += 5) { // j = phi(radians)*100		sinphi = sin((double)j/100.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-((j>70) ? TLB : TLA),theta,outfile);	}	for(j = 110; j <= 140; j += 2) { // j = phi(radians)*100		sinphi = sin((double)j/100.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-TLC,theta,outfile);	}	j=145;	sinphi = sin((double)j/100.0);	theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)	drawtick(R2,R2-TLC,theta,outfile);	for(k = 101; k <= 200; k++) { // k = phi(radians)*1000		sinphi = sin((double)k/1000.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-TLC,theta,outfile);	}	for(k = 105; k <= 195; k += 5) {		sinphi = sin((double)k/1000.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-TLB,theta,outfile);	}	for(k = 202; k <= 400; k+=2) {		sinphi = sin((double)k/1000.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-TLC,theta,outfile);	}	for(k = 405; k <= 700; k+=5) {		sinphi = sin((double)k/1000.0);		theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)		drawtick(R2,R2-TLC,theta,outfile);	}	fprintf(outfile, "/Symbol findfont        %% Get the symbol font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n");	theta = 0; // pi/2 mark	drawtick(R2,R2-(2.0*TLA),theta,outfile);	drawlabel("p/2",R2-(2.0*TLA)-((double)FSIZE/72.0),theta,outfile);	sinphi = sin(PI/4.0); // pi/4 mark	theta = log10(sinphi)*2.0*PI; // inner multiplication disk will give sin(phi)	drawtick(R2,R2-(2.0*TLA),theta,outfile);	drawlabel("p/4",R2-(2.0*TLA)-((double)FSIZE/72.0),theta,outfile);	fprintf(outfile, "/Times-Roman findfont   %% Get back the basic font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n");		fprintf(outfile,"grestore\n");// Restore from inner scale translation	fprintf(outfile,"grestore\n");// Restore from Side 1 translation			//SIDE 2: OUTER SCALE	fprintf(outfile, "%% SIDE 2: OUTER SCALE\n");		fprintf(outfile, "newpath                 %% Begin crosshairs at center\n");	fprintf(outfile, "%f inch %f inch moveto\n",XC,YC-TLA);	fprintf(outfile, "%f inch %f inch lineto\n",XC,YC+TLA);	fprintf(outfile, "stroke\n");	fprintf(outfile, "newpath\n");	fprintf(outfile, "%f inch %f inch moveto\n",XC-TLA,YC);	fprintf(outfile, "%f inch %f inch lineto\n",XC+TLA,YC);	fprintf(outfile, "stroke\n");	fprintf(outfile, "\n");		drawheading("SIDE 2: OUTER SCALE",outfile);		for(i=1; i < 10; i++) { // Big ticks (size A)		theta = log10((double)i)*2.0*PI;		drawtick(R, R+TLA, theta, outfile);		sprintf(label,"%d",i);		drawlabel(label,R+TLA,theta,outfile);		for(j=0; j < 10; j++) { // 1/10 ticks (size B)			theta = log10((double)i+((double)j)/10.0)*2.0*PI;			drawtick(R, R+((j==5) ? TLA : TLB), theta, outfile);			if(i == 1) { // Don't label if too close together.				if(j > 0) {					sprintf(label,"%d.%d",i,j);					drawlabel(label,R+TLB,theta,outfile);				}				for(k=1; k < 10; k++) {					theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;					drawtick(R, R+((k==5) ? TLB : TLC), theta, outfile);				}			} else if(i <= 4) {				for(k=2; k < 10; k=k+2) {					theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;					drawtick(R, R+TLC, theta, outfile);				}			} else if(i <= 9) {				k=5;				theta = log10((double)i+((double)j)/10.0+((double)k)/100.0)*2.0*PI;				drawtick(R, R+TLC, theta, outfile);			}		}	}	theta = log10(E)*2.0*PI; // e label	drawtick(R, R+TLA, theta, outfile);	drawlabel("e",R+TLA,theta,outfile);		theta = log10(PI)*2.0*PI; // pi label	fprintf(outfile, "/Symbol findfont        %% Get the symbol font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n");	drawtick(R, R+TLA, theta, outfile);	drawlabel("p",R+TLA,theta,outfile);	fprintf(outfile, "/Times-Roman findfont   %% Get back the basic font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n");		//SIDE 2: INNER SCALES, FOR EXPONENTIATION	fprintf(outfile, "%% SIDE 2: INNER SCALES, FOR EXPONENTIATION\n");	fprintf(outfile, "gsave\n");	fprintf(outfile, "3.75 inch 0 inch translate\n");		fprintf(outfile, "newpath                 %% Begin crosshairs at center\n");	fprintf(outfile, "%f inch %f inch moveto\n",XC,YC-TLA);	fprintf(outfile, "%f inch %f inch lineto\n",XC,YC+TLA);	fprintf(outfile, "stroke\n");	fprintf(outfile, "newpath\n");	fprintf(outfile, "%f inch %f inch moveto\n",XC-TLA,YC);	fprintf(outfile, "%f inch %f inch lineto\n",XC+TLA,YC);	fprintf(outfile, "stroke\n");	fprintf(outfile, "\n");		drawheading("SIDE 2: INNER SCALES, FOR EXPONENTIATION",outfile);	// e mark	expx = exp(1.0);	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLB, theta, outfile);	drawlabel("e", R-TLB-((double)FSIZE/72.0),theta,outfile);	for(i = 3; i <= 15; i++) {		expx = (float)i;		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLA, theta, outfile);		if((i < 11) || (i > 14)){			sprintf(label, "%d", i);			drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		}	}	for(i = 20; i <= 50; i+=10) {		expx = (float)i;		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLA, theta, outfile);		sprintf(label, "%d", i);		drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);	}	i=100;	expx = (float)i;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);	sprintf(label, "%d", i);	drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		i=200;	expx = (float)i;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);	sprintf(label, "%d", i);	drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		i=500;	expx = (float)i;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);	sprintf(label, "%d", i);	drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		i=1000;	expx = (float)i;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);	sprintf(label, "%d", i);	drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		i=2000;	expx = (float)i;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);	sprintf(label, "%d", i);	drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		i=5000;	expx = (float)i;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);	sprintf(label, "%d", i);	drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		i=10000;	expx = (float)i;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);	sprintf(label, "%d", i);	drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		i=20000;	expx = (float)i;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);	sprintf(label, "%d", i);	drawlabel(label, R-TLA-((double)FSIZE/72.0),theta,outfile);		for(expx = 3.5; expx <= 5.51 ;expx += 1.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLA, theta, outfile);	}	expx = 25.0;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);		expx = 150.0;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);		expx = 300.0;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);		expx = 400.0;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLA, theta, outfile);		for(expx = 2.8; expx <= 5.91 ;expx += 0.1) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLB, theta, outfile);	}		for(expx = 6.5; expx <= 9.51 ;expx += 1.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLB, theta, outfile);	}		for(expx = 11.0; expx <= 29.01 ;expx += 1.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLB, theta, outfile);	}	expx = 35.0;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLB, theta, outfile);		expx = 45.0;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLB, theta, outfile);		for(expx = 60.0; expx <= 190.1 ;expx += 10.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLB, theta, outfile);	}		for(expx = 250.0; expx <= 450.1 ;expx += 100.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLB, theta, outfile);	}		for(expx = 600.0; expx <= 900.1 ;expx += 100.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLB, theta, outfile);	}		expx = 1500.0;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLB, theta, outfile);		for(expx = 3000.0; expx <= 9000.1 ;expx += 1000.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLB, theta, outfile);	}		expx = 15000.0;	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R, R-TLB, theta, outfile);		for(expx = 2.72; expx <= 3.981;expx += 0.02) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 4.05; expx <= 5.951;expx += 0.1) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 6.1; expx <= 9.91;expx += 0.1) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 10.2; expx <= 14.81;expx += 0.2) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 15.5; expx <= 29.51;expx += 1.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 31.0; expx <= 49.1;expx += 1.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 52.0; expx <= 98.1;expx += 2.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 105.0; expx <= 195.1;expx += 10.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 210.0; expx <= 490.1;expx += 10.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 550.0; expx <= 950.1;expx += 100.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 1100.0; expx <= 1900.1;expx += 100.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 2200.0; expx <= 4800.1;expx += 200.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 5500.0; expx <= 9500.1;expx += 1000.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		for(expx = 11000.0; expx <= 21000.1;expx += 1000.0) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R, R-TLC, theta, outfile);	}		//Innermost exponentiation scale on side 2	// e mark	expx = exp(1.0);	theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)	drawtick(R2, R2-TLB, theta, outfile);	drawlabel("e", R2-TLB-((double)FSIZE/72.0),theta,outfile);	for(expx = 1.11; expx <= 1.191; expx += 0.01) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLA, theta, outfile);		if (expx < 1.155) {			sprintf(label, "  %.2f", expx);			drawlabel(label, R2-TLA-((double)FSIZE/72.0),theta,outfile);		}	}	for(expx = 1.20; expx <= 1.551; expx += 0.05) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLA, theta, outfile);		sprintf(label, "%.2f", expx);		drawlabel(label, R2-TLA-((double)FSIZE/72.0),theta,outfile);	}	for(expx = 1.6; expx <= 2.701; expx += 0.1) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLA, theta, outfile);		if (expx < 2.35) {			sprintf(label, "%.1f", expx);			drawlabel(label, R2-TLA-((double)FSIZE/72.0),theta,outfile);		}	}	for(expx = 2.5; expx <= 2.701; expx += 0.2) { //stuff not labeled in last loop		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		sprintf(label, "%.1f", expx);		drawlabel(label, R2-TLA-((double)FSIZE/72.0),theta,outfile);	}	for(expx = 1.115; expx <= 1.1951; expx += 0.01) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLB, theta, outfile);	}	for(expx = 1.21; expx <= 1.591; expx += 0.01) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLB, theta, outfile);	}	for(expx = 1.55; expx <= 1.951; expx += 0.1) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLB, theta, outfile);	}	for(expx = 1.106; expx <= 1.1991; expx += 0.001) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLC, theta, outfile);	}	for(expx = 1.202; expx <= 1.3981; expx += 0.002) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLC, theta, outfile);	}	for(expx = 1.405; expx <= 1.5951; expx += 0.01) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLC, theta, outfile);	}	for(expx = 1.61; expx <= 1.991; expx += 0.01) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLC, theta, outfile);	}	for(expx = 2.02; expx <= 2.681; expx += 0.02) {		theta = log10(log(expx))*2.0*PI; // inner disk gives exp(x)		drawtick(R2, R2-TLC, theta, outfile);	}		fprintf(outfile,"grestore\n");// Restore from inner scale translation	fprintf(outfile,"showpage\n");	fclose(outfile);		// PAGE 2: TRANSPARENT PLACEHOLDER	outfile = fopen("csr_2of2.ps","w");	fprintf(outfile, "%%!\n");	fprintf(outfile, "%% PostScript pattern for a precision circular slide rule, part 2\n");	fprintf(outfile, "%% Copyright (C) 1997 by Charles C. Kankelborg\n");	fprintf(outfile, "%% This PostScript program may be freely distributed for noncommercial\n");	fprintf(outfile, "%% use, as long as the accompanying copyright notice remains intact.\n");	fprintf(outfile, "%% No warranty. Use at your own risk.\n");	fprintf(outfile, "/inch {72 mul} def	%% Convert inches->points (1/72 inch)\n");	fprintf(outfile, "0 setlinewidth  %% hairline\n");	fprintf(outfile, "/Times-Roman findfont   %% Get the basic font\n");	fprintf(outfile, "%d scalefont             %% Scale the font to %d points\n",FSIZE,FSIZE);	fprintf(outfile, "setfont                 %% Make it the current font\n\n");	fprintf(outfile, "%% PAGE 2: TRANSPARENT CURSOR\n");		fprintf(outfile,"newpath\n");	fprintf(outfile,"%f inch %f inch moveto\n",0.5, 0.5);	fprintf(outfile,"(TRANSPARENT CURSOR - print on transparency; enough for 10) show\n");	fprintf(outfile,"%f inch %f inch moveto\n",4.25, 0.5);	fprintf(outfile,"(Copyright \(C\) 1997 by Charles C. Kankelborg) show\n");	for (i=1.0; i<=10.01; i+=1.0) {		fprintf(outfile, "newpath                 %% horizontal line\n");		fprintf(outfile, "%f inch %f inch moveto\n",XC-TLA,i+.001);		fprintf(outfile, "%f inch %f inch lineto\n",XC+3.75+TLA,i+.001);		fprintf(outfile, "stroke\n");			fprintf(outfile, "newpath                 %% vertical line1\n");		fprintf(outfile, "%f inch %f inch moveto\n",XC-TLC,i+TLA);		fprintf(outfile, "%f inch %f inch lineto\n",XC-TLC,i-TLA);		fprintf(outfile, "stroke\n");				fprintf(outfile, "newpath                 %% vertical line2\n");		fprintf(outfile, "%f inch %f inch moveto\n",XC+3.75+TLC,i+TLA);		fprintf(outfile, "%f inch %f inch lineto\n",XC+3.75+TLC,i-TLA);		fprintf(outfile, "stroke\n");				fprintf(outfile, "\n");	}	fprintf(outfile,"showpage\n");		fclose(outfile);		printf("Finished.\n");}