/* In this file, I have tried to reproduce the code on pages 83-84 as accurately as possible. However, this strange version outputs only integers (no floating-point). Almost nobody will need this. */ #include #include #define PI 3.1415926 #define START_T 0.0 #define STOP_T (2*PI) #define LEFT -1100 #define BOTTOM -1100 #define RIGHT 1100 #define TOP 1100 #define STEP 400 #define WIDTH 6 main() { int i; double x, y, t; printf("w %d %d %d %d\n",LEFT,BOTTOM,RIGHT,TOP); printf("W %d\n",WIDTH); for (i=0; i<=STEP; i++) { t = START_T + ((double)i/STEP)*(STOP_T - START_T); x = cos(t); y = sin(t); if (i == 0) printf("m %d %d\n",(int)(1000*x),(int)(1000*y)); else printf("l %d %d\n",(int)(1000*x),(int)(1000*y)); } }