void display(int pnum){ int i, j, k; G_rgb(0,0,0); G_clear(); G_clear(1,1,1); // printf("enter disp\n"); for(i=0;i<numpolys[pnum];i++){ double xtemp[poly_sizes[pnum][i]], ytemp[poly_sizes[pnum][i]]; // printf("New display\n"); for(j=0; j<poly_sizes[pnum][i];j++){ xtemp[j] = x[pnum][polygons[pnum][i][j]]; ytemp[j] = y[pnum][polygons[pnum][i][j]]; // printf("X = %lf Y = %lf \n",xtemp[j],ytemp[j] ); } G_rgb(colors[pnum][i][0],colors[pnum][i][1],colors[pnum][i][2]); G_fill_polygon(xtemp, ytemp ,poly_sizes[pnum][i]); } double a[3][3], b[3][3]; D2d_make_identity(a); D2d_make_identity(b); D2d_translate(a, b, -WINDOW_WIDTH/2, -WINDOW_WIDTH/2); D2d_rotate(a,b, ROTATE_SPEED); D2d_translate(a, b, WINDOW_WIDTH/2, WINDOW_WIDTH/2); D2d_mat_mult_points(x[pnum], y[pnum], a, x[pnum], y[pnum],numpoints[pnum]); }
void display(int pnum){ int i, j, k; G_rgb(0,0,0); G_clear(); G_clear(1,1,1); // printf("enter disp\n"); for(i=0;i<numpolys[pnum];i++){ double xtemp[1000], ytemp[1000]; // printf("New display\n"); for(j=0; j<poly_sizes[pnum][i];j++){ xtemp[j] = x[pnum][polygons[pnum][i][j]]; ytemp[j] = y[pnum][polygons[pnum][i][j]]; // printf("X = %lf Y = %lf \n",xtemp[j],ytemp[j] ); } int tsize = clip(xtemp,ytemp,poly_sizes[pnum][i]); G_rgb(colors[pnum][i][0],colors[pnum][i][1],colors[pnum][i][2]); G_fill_polygon(xtemp, ytemp ,tsize); } double a[3][3], b[3][3]; D2d_make_identity(a); D2d_make_identity(b); D2d_translate(a, b, -WINDOW_WIDTH/2, -WINDOW_WIDTH/2); D2d_rotate(a,b, ROTATE_SPEED); D2d_translate(a, b, WINDOW_WIDTH/2, WINDOW_WIDTH/2); D2d_mat_mult_points(x[pnum], y[pnum], a, x[pnum], y[pnum],numpoints[pnum]); for(i=0; i<cSize;i++){//show clipping box G_rgb(255,255,255); G_line(cx[i], cy[i], cx[(i+1)%cSize], cy[(i+1)%cSize]); } }
int main() { double j,r,q ; size = 600 ; G_init_graphics(size, size) ; G_rgb(0, 0, 0) ; G_clear() ; G_rgb(1.0, 0.0, 0.0) ; j = 0 ; while (j < 500000) { r = drand48() ; // diagonal_line(r) ; filled_triangle(r) ; G_point (x[0], y[0]) ; j=j+1 ; } q = G_wait_key() ; }
int main(){ int x; G_init_graphics(600,600); int i; char prefix[100], filename[100]; strncpy(prefix, "tetrahedron", 100); scanf("%s", textureName); //tetrahedron0000 //14 for(i=0; i < 73; i++){ printf("%d\n", i); init_scene(i); sprintf(filename, "%s%04d", prefix, i); filename[15] = '.'; filename[16] = 'x'; filename[17] = 'w'; filename[18] = 'd'; G_save_image_to_file(filename); G_wait_key(); G_rgb(1,1,1); G_clear(); } //main->init scene->draw }
int main() { double xp[1000],yp[1000] ; int n,q ; double P[2] ; swidth = 700 ; sheight = 700 ; G_init_graphics(swidth, sheight) ; G_rgb(0,0,0) ; G_clear() ; G_rgb(1,0,0) ; n = click_and_save(xp,yp) ; G_rgb(0,1,0) ; G_fill_polygon(xp,yp,n) ; while(1==1){ G_wait_click(P) ; if(P[1] < 40){ break; } int r = in_out(xp,yp,n,P); if(r==1){ G_rgb(1,0,0); }else{ G_rgb(0,0,1) ; } G_fill_circle(P[0],P[1],2) ; } q = G_wait_key() ; }
int main(){ double ax[100], ay[100], bx[100], by[100]; int anum, bnum; G_init_graphics(WINDOW,WINDOW); G_rgb(0,0,0); G_clear(); G_clear(1,1,1); G_rgb(1,1,1); G_draw_string("Save", 0,585); G_rgb(0,1,0); anum = clickandsave(ax,ay); my_fill_polygon(ax, ay, anum); G_rgb(1,0,0); bnum = clickandsave(bx, by); //printf("anum: %d bnum %d \n", anum, bnum); my_fill_polygon(bx,by,bnum); G_wait_key(); }
void draw() { G_rgb(.1, .1, .1); G_clear(); draw_object3ds(objs, num_objs, fov, light_pos, lm); //printf("draw\n"); char fovstring[128]; sprintf(fovstring, "Fov: %.3f rad", fov); char camerastring[128]; sprintf(camerastring, "Camera: x:0 y:0 z:%f", 0.0); G_rgb(1, 1, 1); G_draw_string(fovstring, 0, 580); G_draw_string(camerastring, 0, 560); G_display_image(); }
int main() { G_init_graphics(600,600) ; G_rgb(0,0,0) ; G_clear() ; G_rgb(0,0,1) ; G_fill_polygon(jx,jy,5) ; G_wait_key(); double rot45[3][3]; double useless[3][3]; D2d_make_identity(rot45); D2d_rotate(rot45, useless, M_PI/4.0); D2d_mat_mult_points(jx, jy, rot45, jx, jy, 5); G_fill_polygon(jx, jy, 5); double upandover[3][3]; D2d_make_identity(upandover); D2d_translate(upandover, useless, 1, 1); int count = 0; while (G_wait_key()) { count = (count+1)%200; D2d_mat_mult_points(jx, jy, upandover, jx, jy, 5); G_rgb(0, 0, 0); G_clear(); G_rgb(0, 0, 1); if (count < 100) { G_fill_polygon(jx, jy, 5); } else { G_fill_polygon(jy, jx, 5); } G_rgb(1, 0, 0); G_line(0, 0, 600, 600); } }
void redraw(){ int i; G_rgb(1,1,1); G_clear(); for(i=0;i<numPolygons;i++){ buildPoly(i); } }
void Draw(double degrees) { double xcen,ycen,radius ; int i,n ; double delta,u,v ; double x0,y0, x1,y1,x2,y2 ; double color ; double r,g,b ; G_clear() ; n = 24 ; xcen = 0.5*swidth ; ycen = 0.5*sheight ; if (swidth < sheight) { radius = 0.4*swidth ;} else { radius = 0.4*sheight ; } delta = 360.0/n ; for (i = 0 ; i < n ; i+=1) { u = degrees + i*delta ; v = u + delta ; u *= (M_PI/180) ; v *= (M_PI/180) ; x0 = xcen ; y0 = ycen ; x1 = xcen + radius*cos(u) ; y1 = ycen + radius*sin(u) ; x2 = xcen + radius*cos(v) ; y2 = ycen + radius*sin(v) ; if (i == 0) { r = 1 ; g = 1 ; b = 0 ; } else if (i % 2 == 0) { r = 1 ; g = 0 ; b = 0 ; } else { r = 0 ; g = 0 ; b = 1 ; } G_rgb (r,g,b) ; G_fill_triangle(x0,y0, x1,y1, x2,y2) ; } }
int main (int argc, char **argv) { int w,h,nrows, ncols ; double r[2],g[2],b[2] ; int i,j,k,q ; double dx,dy ; if (argc != 12) { printf("Usage : pgm xwd_res_file_name width height nrows ncols r0 g0 b0 r1 g1 b1\n") ; exit(0) ; } w = atoi(argv[2]) ; h = atoi(argv[3]) ; nrows = atoi(argv[4]) ; ncols = atoi(argv[5]) ; r[0] = atof(argv[6]) ; g[0] = atof(argv[7]) ; b[0] = atof(argv[8]) ; r[1] = atof(argv[9]) ; g[1] = atof(argv[10]) ; b[1] = atof(argv[11]) ; G_init_graphics(w,h) ; G_rgb(0,1,0) ; G_clear() ; // reveals a green bottom line...error in FPT's G_fill_rectangle // ...now fixed dx = 1.0*w/ncols ; dy = 1.0*h/nrows ; for (i = 0 ; i < ncols ; i++) { for (j = 0 ; j < nrows ; j++) { k = (i + j) % 2 ; G_rgb(r[k],g[k],b[k]) ; G_fill_rectangle(i*dx,j*dy,dx,dy) ; } } q = G_wait_key() ; G_save_image_to_file(argv[1]) ; }
int main() { double j ; char q ; G_init_graphics(601, 601) ; // the original design was for a 400x400 // window and the object is centered on 200,200 // so we recenter it and make it larger translate(-200, -200) ; scale(2.0) ; translate(300, 300) ; j = 0 ; while (j < 100) { G_rgb(0,0,0) ; G_clear() ; G_rgb(0, 0.5, 1) ; G_fill_polygon(x,y,n) ; G_rgb(1, 1, 0) ; G_polygon(x,y,n) ; // q = G_wait_key() ; G_display_image() ; usleep(25000) ; // microseconds translate(-300, -300) ; scale(0.95) ; rotate(4) ; translate(300, 300) ; j=j+1 ; } G_rgb(1,0,0) ; G_fill_circle(300,300, 50) ; q = G_wait_key() ; }
void redraw(){ int i; G_rgb(1,1,1); G_clear(); //printf("%d\n", numPolygons[thisObj]); for(i=0;i<numPolygons[thisObj];i++){ buildPoly(i); } }
int main() // this tests clipping of polygon to convex window //prefix -p == polygon; prefix -w == window { int pn, wn ; double pt[2], u, v, q ; double px[100] = { 70, 460, 400} ; double py[100] = { 350, 25, 550} ; pn = 3 ; double wx[100] = { 100, 600, 550, 150} ; double wy[100] = { 150, 200, 450, 500} ; wn = 4 ; srand48(100) ; G_init_graphics (700, 700) ; G_rgb (0, 0, 0) ; G_clear() ; G_rgb (1, 0, 0) ; G_polygon(wx, wy, wn) ; G_rgb (0, 0, 1) ; G_polygon(px, py, pn) ; q = G_wait_key() ; pn = Clip_Polygon_Against_Convex_Window (px, py, pn, wx, wy, wn) ; G_rgb (1, 1, 0) ; for (int i = 0; i < pn; i++) { G_fill_circle(px[i], py[i], 2); printf("x:%.2lf, y:%.2lf\n", px[i], py[i]); } G_fill_polygon(px, py, pn) ; q = G_wait_key() ; }
int main() { int q ; G_init_graphics(601, 601) ; G_rgb(0,0,0) ; G_clear() ; G_rgb(0,0,1) ; G_fill_polygon(x,y,n) ; q = G_wait_key() ; translate(150, 50) ; G_rgb(1,0,1) ; G_fill_polygon(x,y,n) ; q = G_wait_key() ; }
int main () { char prefix[100], sequence_name[100] ; int s,e,i ; double f ; printf("enter prefix name ") ; scanf("%s",prefix) ; printf("enter starting integer ") ; scanf("%d",&s) ; printf("enter ending integer ") ; scanf("%d",&e) ; /* printf("\n") ; for (i = s ; i <= e ; i++) { sprintf(sequence_name, "%s%04d.xwd", prefix, i) ; printf("%s\n",sequence_name) ; } */ G_init_graphics(400,400) ; for (i = s ; i <= e ; i++) { G_rgb(0,0,0) ; G_clear() ; f = 1.0*i/(e - s + 1) ; G_rgb(1,f,0) ; G_fill_circle(200,200,i) ; sprintf(sequence_name, "%s%04d.xwd", prefix, i) ; G_save_image_to_file(sequence_name) ; } G_close() ; }
int main() { G_init_graphics(600, 600); for (int j = 0; j < 200; ++j) { { usleep(20000); G_rgb(drand48(),drand48(),drand48()); G_clear(); G_rgb(drand48(),drand48(),drand48()); G_fill_polygon(x,y,n) ; G_display_image(); // clearing, choosing random colors } translate(-300, -300) ; scale(0.98, 0.98) ; rotate(3.0) ; translate(300, 300) ; } int close = G_wait_key() ; }
void redraw(){ int k = buildArray(); int i, j; G_rgb(0,0,.3); G_clear(); for(i =0; i < k; i++){ buildPoly(i); } G_rgb(1,0,0); G_point((300/H)*lightPos[0]/lightPos[2] + 300, (300/H)*lightPos[1]/lightPos[2] + 300); /* //printf("%d\n", numPolygons[thisObj]); for(thisObj=0;thisObj<numObjects; thisObj++){ for(i=0;i<numPolygons[thisObj];i++){ buildPoly(i); } } */ // exit(1) ; }
int main() { double swidth, sheight ; swidth = 601 ; sheight = 601 ; G_init_graphics (swidth, sheight); int res, numpoints; double r, x[3], y[3], p, i, k; k = 0; res = 47; p = (M_PI / (res / 2)); numpoints = 3; while (true) { G_rgb(1, 1, 1); G_clear(); G_rgb(0, 0, 0); i = 0; while(i < res) { x[1] = 240 * cos((i + 1 + k/4) * p) + 300; y[1] = 80 * sin((i + 1 + k/4) * p) + 450; x[2] = 240 * cos((i + k/4) * p) + 300; y[2] = 80 * sin((i + k/4) * p) + 450; x[0] = 300; y[0] = 450; G_fill_polygon (x, y, numpoints); i++; x[1] = 240 * cos((i + 1 + k/4) * p) + 300; y[1] = 80 * sin((i + 1 + k/4) * p) + 450; x[2] = 240 * cos((i + k/4) * p) + 300; y[2] = 80 * sin((i + k/4) * p) + 450; x[0] = 300; y[0] = 150; if (y[1] < 436 && y[2] < 436) { G_fill_polygon (x, y, numpoints); } i++; } G_rgb(1, 0, 0); x[1] = 240 * cos((1 + k/4) * p) + 300; y[1] = 80 * sin((1 + k/4) * p) + 450; x[2] = 240 * cos((k/4) * p) + 300; y[2] = 80 * sin((k/4) * p) + 450; x[0] = 300; y[0] = 450; G_fill_polygon (x, y, numpoints); if (y[1] < 436 && y[2] < 436) { x[0] = 300; y[0] = 150; G_fill_polygon (x, y, numpoints); } G_rgb(0, 0, 0); k++; i = G_wait_key(); if (i == 'q') { break; } } }
int main (int argc, char **argv) { char q, action; double mat[4][4], minv[4][4], scaleFactor; double radians = 3 * (M_PI / 180); FILE *g; int cc, sign, currentObj, k, h; int increment = 15; int xcounter, ycounter, zcounter = 0; for (cc = 1; cc < argc; cc++) { g = fopen(argv[cc], "r"); //opens a file; r = read only if (g == NULL) { //if the file is empty, it will let me know printf("can't open (1)\n"); exit(1); } else { readobject(g, cc); D3d_make_identity(mat); D3d_make_identity(minv); scaleFactor = scale_n_fit(cc); D3d_translate(mat, minv, -centerx, -centery, -centerz); D3d_scale(mat, minv, scaleFactor, scaleFactor, scaleFactor); D3d_mat_mult_points(x[cc], y[cc], z[cc], mat, x[cc], y[cc], z[cc], points[cc]); // printarray(z[cc], points[cc]); } } welcome(argc - 1); scanf("%c", &q); currentObj = q - '0'; sign = 1 ; action = 't' ; if (currentObj < argc && currentObj > 0) { G_init_graphics(WIDTH, HEIGHT); while (1) { G_rgb(0, 0, 0); G_clear(); drawit(currentObj); D3d_make_identity (mat) ; D3d_make_identity (minv) ; q = G_wait_key() ; if (q == 'q') { exit(0) ; } else if (q == 'c') { sign = -sign ; } else if (q == 't') { action = q ; } else if (q == 's') { reverse = -reverse; } else if (q == 'r') { action = q ; } else if (('0' <= q) && (q <= '9')) { k = q - '0' ; if (h != currentObj) { currentObj = k; } } else if ((q == 'x') && (action == 't')) { D3d_translate (mat, minv, sign * increment, 0, 0); xcounter = xcounter + (sign * increment); } else if ((q == 'y') && (action == 't')) { D3d_translate (mat, minv, 0, sign * increment, 0); ycounter = ycounter + (sign * increment); } else if ((q == 'z') && (action == 't')) { D3d_translate(mat, minv, 0, 0, sign * increment); zcounter = zcounter + (sign * increment); } else if ((q == 'x') && (action == 'r')) { D3d_translate(mat, minv, -xcounter, -ycounter, -zcounter); D3d_rotate_x(mat, minv, sign * radians); D3d_translate(mat, minv, xcounter, ycounter, zcounter); } else if ((q == 'y') && (action == 'r')) { D3d_translate(mat, minv, -xcounter, -ycounter, -zcounter); D3d_rotate_y(mat, minv, sign * radians); D3d_translate(mat, minv, xcounter, ycounter, zcounter); } else if ((q == 'z') && (action == 'r')) { D3d_translate(mat, minv, -xcounter, -ycounter, -zcounter); D3d_rotate_z(mat, minv, sign * radians); D3d_translate(mat, minv, xcounter, ycounter, zcounter); } else { printf("no action\n") ; } D3d_mat_mult_points (x[currentObj], y[currentObj], z[currentObj], mat, x[currentObj], y[currentObj], z[currentObj], points[currentObj] + 1) ; //the numpoints[currentObj]+1 is because we have stored //the center of the object at the arrays' end G_rgb(0, 0, 0); G_clear(); drawit(currentObj); } } }
void setUp(){ G_init_graphics(WINDOW_WIDTH,WINDOW_WIDTH + 30); G_rgb(0,0,0); G_clear(); G_clear(1,1,1); }
void display(int pnum, int sign, int specpow, double diffusepro, double ambient, double lightx, double lighty, double lightz){ int i, j, k, m; G_rgb(0,0,0); G_clear(); double halfAngle = 30*M_PI/180; G_clear(1,1,1); if(sign == 0){ sign = -1; }else{ sign=1; } int n=0; for(n=0; n<plsize; n++){ double xtemp[100]; double ytemp[100]; double ztemp[100]; for(j=0; j<poly_sizes[polyLoc[n].objnum][polyLoc[n].polynum];j++){ xtemp[j] = x[polyLoc[n].objnum][polygons[polyLoc[n].objnum][polyLoc[n].polynum][j]]; ytemp[j] = y[polyLoc[n].objnum][polygons[polyLoc[n].objnum][polyLoc[n].polynum][j]]; ztemp[j] = z[polyLoc[n].objnum][polygons[polyLoc[n].objnum][polyLoc[n].polynum][j]]; } int tempsize = poly_sizes[polyLoc[n].objnum][polyLoc[n].polynum]; double perpendicular[3], first[3], second[3], eye[3], light[3],reflection[3]; tempsize = Clip_Polygon_Against_Window(xtemp,ytemp,ztemp, poly_sizes[polyLoc[n].objnum][polyLoc[n].polynum]); if(tempsize < 1)continue; first[0] = xtemp[0]-xtemp[1]; first[1] = ytemp[0]-ytemp[1]; first[2] = ztemp[0]-ztemp[1]; second[0] = xtemp[0]-xtemp[2]; second[1] = ytemp[0]-ytemp[2]; second[2] = ztemp[0]-ztemp[2]; eye[0] = 0 - xtemp[0] ; eye[1] = 0 - ytemp[0] ; eye[2] = 0 - ztemp[0] ; light[0]= lightx - xtemp[0] ; light[1]= lighty - ytemp[0] ; light[2]= lightz - ztemp[0] ; double xfinal[tempsize], yfinal[tempsize]; for(j=0; j<tempsize;j++){ xfinal[j] = xtemp[j]/ztemp[j]; yfinal[j] = ytemp[j]/ztemp[j]; xfinal[j] = (xfinal[j] * (300/tan(halfAngle))) + 300; yfinal[j] = (yfinal[j] * (300/tan(halfAngle))) + 300; } D3d_x_product(perpendicular,first,second); double length = sqrt(perpendicular[0]*perpendicular[0] + perpendicular[1]*perpendicular[1] + perpendicular[2]*perpendicular[2]); perpendicular[0] = perpendicular[0]/length; perpendicular[1] = perpendicular[1]/length; perpendicular[2] = perpendicular[2]/length; double lightLength = sqrt(light[0]*light[0] + light[1]*light[1] + light[2]*light[2]); light[0] = light[0]/lightLength; light[1] = light[1]/lightLength; light[2] = light[2]/lightLength; double eyelength = sqrt(eye[0]*eye[0] + eye[1]*eye[1] + eye[2]*eye[2]); eye[0] = eye[0]/eyelength; eye[1] = eye[1]/eyelength; eye[2] = eye[2]/eyelength; double pl = dot_product(perpendicular, light); if(pl < 0){ perpendicular[0] = -1 * perpendicular[0]; perpendicular[1] = -1 * perpendicular[1]; perpendicular[2] = -1 * perpendicular[2]; pl = dot_product(perpendicular, light); } double pe = dot_product(perpendicular, eye); double intensity; if (pe < 0) { intensity = ambient ; goto JJJ ; } double diffuse = diffusepro * pl; reflection[0] = ((2 * pl) * perpendicular[0]) - light[0]; reflection[1] = ((2 * pl) * perpendicular[1]) - light[1]; reflection[2] = ((2 * pl) * perpendicular[2]) - light[2]; double specular; specular = (1 - ambient - diffusepro) * pow((dot_product(eye, reflection)),specpow); intensity = ambient + diffuse + specular; JJJ : ; double redt, greent, bluet; if(intensity <= ambient + diffusepro){ double f = intensity/ (ambient + diffusepro); redt = f*red[polyLoc[n].objnum]; greent = f* green[polyLoc[n].objnum]; bluet = f*blue[polyLoc[n].objnum]; } else{ double I[3]; I[0] = 1-red[polyLoc[n].objnum]; I[1] = 1-green[polyLoc[n].objnum]; I[2] = 1-blue[polyLoc[n].objnum]; double f = (intensity - ambient - diffusepro)/ (1 - ambient - diffusepro); redt = f*I[0] + red[polyLoc[n].objnum]; greent = f*I[1] + green[polyLoc[n].objnum]; bluet = f*I[2] + blue[polyLoc[n].objnum]; } G_rgb(redt,greent,bluet); G_fill_polygon(xfinal, yfinal, tempsize); G_rgb(0,0,0); G_polygon(xfinal, yfinal, tempsize); } }
int main() { // analog clock using double buffering...simpler double hours,minutes,seconds,x,y,nx,ny,theta,digit ; double hx,hy,mx,my,sx,sy,angle ; double oldhourtheta,oldminutetheta,oldsecondtheta ; char text[3] ; double hms[3] ; double xx[100],yy[100] ; int num ; G_init_graphics(600,600) ; while (0 < 1) { // blank the window G_rgb(0.3, 0.3, 0.3) ; G_clear() ; // outer circle of the clock face G_rgb(0,0,1) ; G_fill_circle(300,300,230) ; G_rgb (1,0.5,0) ; G_fill_circle(300,300,220) ; // digits on the clock face G_rgb (0,0,0) ; theta = 90 ; // degrees digit = 0 ; while (theta > -270) { theta = theta - 30 ; digit = digit + 1 ; nx = 200*cos(theta*M_PI/180) + 300 ; ny = 200*sin(theta*M_PI/180) + 300 ; if (digit >= 10) { text[0] = '1' ; text[1] = '0' + digit - 10 ; text[2] = '\0' ; } else { text[0] = '0' + digit ; text[1] = '\0' ; } G_draw_string(text,nx-5,ny-5) ; } // get_timeD(hms) ; // hours = hms[0] ; // minutes = hms[1] ; // seconds = hms[2] ; printf("enter hours minutes seconds") ; scanf("%lf %lf %lf",&hours,&minutes,&seconds) ; G_rgb (0,0,0) ; // set the second hand theta = 90 - 6*seconds ; angle = theta*M_PI/180 ; sx = 175*cos(angle) + 300 ; sy = 175*sin(angle) + 300 ; // G_line(300,300,sx,sy) ; num = make_arrow (300,300, sx,sy, 3.0, xx,yy) ; G_fill_polygon(xx,yy,num) ; // set the minute hand theta = 90 - 6*(minutes + seconds/60.0) ; angle = theta*M_PI/180 ; mx = 140*cos(angle) + 300 ; my = 140*sin(angle) + 300 ; // G_line(300,300,mx,my) ; num = make_arrow (300,300, mx,my, 3.0, xx,yy) ; G_fill_polygon(xx,yy,num) ; // set the hour hand theta = 90 - 30*(hours + minutes/60.0 + seconds/3600.0) ; angle = theta*M_PI/180 ; hx = 75*cos(angle) + 300 ; hy = 75*sin(angle) + 300 ; // G_line(300,300,hx,hy) ; num = make_arrow (300,300, hx,hy, 3.0, xx,yy) ; G_fill_polygon(xx,yy,num) ; G_rgb(0,0,0) ; G_fill_circle(300,300,12) ; G_display_image() ; break ; } // end while (0 < 1) G_save_image_to_file("clock.xwd") ; }