=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/Attic/plot3d.c,v retrieving revision 1.1.1.2 retrieving revision 1.1.1.3 diff -u -p -r1.1.1.2 -r1.1.1.3 --- OpenXM_contrib/gnuplot/Attic/plot3d.c 2000/01/22 14:16:00 1.1.1.2 +++ OpenXM_contrib/gnuplot/Attic/plot3d.c 2003/09/15 07:09:26 1.1.1.3 @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: plot3d.c,v 1.1.1.2 2000/01/22 14:16:00 maekawa Exp $"; +static char *RCSid = "$Id: plot3d.c,v 1.1.1.3 2003/09/15 07:09:26 ohara Exp $"; #endif /* GNUPLOT - plot3d.c */ @@ -114,16 +114,22 @@ extern int reverse_range[]; * dont know we have to support ranges [10:-10] - lets reverse * it for now, then fix it at the end. */ -#define INIT_ARRAYS(axis, min, max, auto, is_log, base, log_base, infinite) \ -do{if ((auto_array[axis] = auto) == 0 && maxnext_sp, surface++) { fprintf(gpoutfile, "\n#Surface %d of %d surfaces\n", surface, pcount); @@ -702,12 +719,13 @@ int pcount; curve = 0; if (draw_surface) { + strcpy(pcat," %c\n"); /* only the curves in one direction */ while (icrvs && curve < this_plot->num_iso_read) { fprintf(gpoutfile, "\n#IsoCurve %d, %d points\n#x y z type\n", curve, icrvs->p_count); for (i = 0, points = icrvs->points; i < icrvs->p_count; i++) { - fprintf(gpoutfile, "%g %g %g %c\n", + fprintf(gpoutfile, table_format, points[i].x, points[i].y, points[i].z, @@ -723,6 +741,7 @@ int pcount; if (draw_contour) { int number = 0; struct gnuplot_contours *c = this_plot->contours; + strcpy(pcat,"\n"); while (c) { int count = c->num_pts; struct coordinate GPHUGE *p = c->coords; @@ -732,7 +751,7 @@ int pcount; /* double blank line to allow plot ... index ... */ fprintf(gpoutfile, "\n# Contour %d, label: %s\n", number++, c->label); for (; --count >= 0; ++p) - fprintf(gpoutfile, "%g %g %g\n", p->x, p->y, p->z); + fprintf(gpoutfile, table_format, p->x, p->y, p->z); /* blank line between segments of same contour */ putc('\n', gpoutfile); c = c->next; @@ -740,6 +759,8 @@ int pcount; } } fflush(gpoutfile); + + free(table_format); } @@ -1441,7 +1462,28 @@ if(range_flags[axis]&RANGE_WRITEBACK) \ else { START_LEAK_CHECK(); /* assert no memory leaks here ! */ do_3dplot(first_3dplot, plot_num); - END_LEAK_CHECK(); + END_LEAK_CHECK(); + + /* after do_3dplot(), min_array[] and max_array[] + contain the plotting range actually used (rounded + to tic marks, not only the min/max data values) + --> save them now for writeback if requested */ + +#define SAVE_WRITEBACK(axis) \ + if(range_flags[axis]&RANGE_WRITEBACK) { \ + set_writeback_min(axis,min_array[axis]); \ + set_writeback_max(axis,max_array[axis]); \ + } + SAVE_WRITEBACK(FIRST_X_AXIS) + SAVE_WRITEBACK(FIRST_Y_AXIS) + SAVE_WRITEBACK(FIRST_Z_AXIS) + SAVE_WRITEBACK(SECOND_X_AXIS) + SAVE_WRITEBACK(SECOND_Y_AXIS) + SAVE_WRITEBACK(SECOND_Z_AXIS) + SAVE_WRITEBACK(T_AXIS) + SAVE_WRITEBACK(R_AXIS) + SAVE_WRITEBACK(U_AXIS) + SAVE_WRITEBACK(V_AXIS) } /* if we get here, all went well, so record the line for replot */ @@ -1540,7 +1582,7 @@ int *plot_num; tlen = (xp->title ? strlen(xp->title) : 0) + (yp->title ? strlen(yp->title) : 0) + (zp->title ? strlen(zp->title) : 0) + 5; - new_title = gp_alloc((unsigned long) tlen, "string"); + new_title = gp_alloc(tlen, "string"); new_title[0] = 0; if (xp->title && xp->title[0] != '\0') { strcat(new_title, xp->title);