// Copyright (c) 1995, Masanao Izumo #define NSCR 30 col = new int[121]; for(i = 0; i < 121; i++) { r = int(127 * (1.0 + cos(i / 121.0 * 2.0 * M_PI))); g = int(127 * (1.0 + cos(i / 121.0 * 2.0 * M_PI + M_PI / 3.0 * 2.0))); b = int(127 * (1.0 + cos(i / 121.0 * 2.0 * M_PI + M_PI / 3.0 * 4.0))); col[i] = gcolor(r, g, b); } gopen(400, 250, "white", "black"); gwindow(0, 0, 640, 400); rd = M_PI / 180.0; th = 0.0; scr = 1; gflush(False); while(scr <= NSCR) { if(gbutton()) exit(0); sin_x = sin(th * rd); cos_x = cos(th * rd); sin_y = sin(th * rd); cos_y = cos(th * rd); for(z = -200.0; z <= 200.0; z += 10.0) { for(x = -200.0; x <= 200.0; x += 10.0) { r = sqrt(x*x + z*z); y = -30*(cos(r * rd) + cos( 3 * r * rd)); px = x * cos_y + z * sin_y + 320; py = y * cos_x - (-x * sin_y + z * cos_y) * sin_x + 200; if(x != -200.0) { gpen(col[int(y) + 60]); gline(px, py); } else gpset(px, py); } } th += 12.0; gcopy(0, scr); gclear(); scr++; } writeln("**** speed-up ! ****"); while(1) { for(scr = 1; scr <= NSCR; scr++) { if(gbutton()) exit(0); gcopy(scr, 0); gsync(False); sleep(0.05); } }