version 1.1, 2000/01/09 17:00:54 |
version 1.1.1.3, 2003/09/15 07:09:26 |
Line 114 extern int reverse_range[]; |
|
Line 114 extern int reverse_range[]; |
|
* dont know we have to support ranges [10:-10] - lets reverse |
* dont know we have to support ranges [10:-10] - lets reverse |
* it for now, then fix it at the end. |
* it for now, then fix it at the end. |
*/ |
*/ |
#define INIT_ARRAYS(axis, min, max, auto, is_log, base, log_base, infinite) \ |
/* HBB 20021103: try to work around bug in BC3.1: */ |
do{if ((auto_array[axis] = auto) == 0 && max<min) {\ |
static GP_INLINE void |
min_array[axis] = max;\ |
init_3darrays(int axis, double min, double max, int autosc, int is_log, double base, double log_base, TBOOLEAN infinite) |
max_array[axis] = min; /* we will fix later */ \ |
{ |
} else { \ |
if ((auto_array[axis] = autosc) == 0 && max < min) { |
min_array[axis] = (infinite && (auto&1)) ? VERYLARGE : min; \ |
min_array[axis] = max; |
max_array[axis] = (infinite && (auto&2)) ? -VERYLARGE : max; \ |
max_array[axis] = min; /* we will fix later */ |
} \ |
} else { |
log_array[axis] = is_log; base_array[axis] = base; log_base_array[axis] = log_base;\ |
min_array[axis] = (infinite && (autosc & 1)) ? VERYLARGE : min; |
}while(0) |
max_array[axis] = (infinite && (autosc & 2)) ? -VERYLARGE : max; |
|
} |
|
log_array[axis] = is_log; |
|
base_array[axis] = base; |
|
log_base_array[axis] = log_base; |
|
} |
|
#define INIT_ARRAYS init_3darrays |
|
|
/* handle reversed ranges */ |
/* handle reversed ranges */ |
#define CHECK_REVERSE(axis) \ |
#define CHECK_REVERSE(axis) \ |
|
|
int i, curve, surface; |
int i, curve, surface; |
struct iso_curve *icrvs; |
struct iso_curve *icrvs; |
struct coordinate GPHUGE *points; |
struct coordinate GPHUGE *points; |
|
char *table_format = NULL; |
|
char * pcat; |
|
|
|
table_format = gp_alloc(strlen(xformat)+strlen(yformat)+strlen(zformat)+6, |
|
"table format"); |
|
strcpy(table_format, xformat); |
|
strcat(table_format, " "); |
|
strcat(table_format, yformat); |
|
strcat(table_format, " "); |
|
strcat(table_format, zformat); |
|
pcat = &table_format[strlen(table_format)]; |
|
|
for (surface = 0, this_plot = first_3dplot; surface < pcount; |
for (surface = 0, this_plot = first_3dplot; surface < pcount; |
this_plot = this_plot->next_sp, surface++) { |
this_plot = this_plot->next_sp, surface++) { |
fprintf(gpoutfile, "\n#Surface %d of %d surfaces\n", surface, pcount); |
fprintf(gpoutfile, "\n#Surface %d of %d surfaces\n", surface, pcount); |
|
|
curve = 0; |
curve = 0; |
|
|
if (draw_surface) { |
if (draw_surface) { |
|
strcpy(pcat," %c\n"); |
/* only the curves in one direction */ |
/* only the curves in one direction */ |
while (icrvs && curve < this_plot->num_iso_read) { |
while (icrvs && curve < this_plot->num_iso_read) { |
fprintf(gpoutfile, "\n#IsoCurve %d, %d points\n#x y z type\n", |
fprintf(gpoutfile, "\n#IsoCurve %d, %d points\n#x y z type\n", |
curve, icrvs->p_count); |
curve, icrvs->p_count); |
for (i = 0, points = icrvs->points; i < icrvs->p_count; i++) { |
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].x, |
points[i].y, |
points[i].y, |
points[i].z, |
points[i].z, |
|
|
if (draw_contour) { |
if (draw_contour) { |
int number = 0; |
int number = 0; |
struct gnuplot_contours *c = this_plot->contours; |
struct gnuplot_contours *c = this_plot->contours; |
|
strcpy(pcat,"\n"); |
while (c) { |
while (c) { |
int count = c->num_pts; |
int count = c->num_pts; |
struct coordinate GPHUGE *p = c->coords; |
struct coordinate GPHUGE *p = c->coords; |
|
|
/* double blank line to allow plot ... index ... */ |
/* double blank line to allow plot ... index ... */ |
fprintf(gpoutfile, "\n# Contour %d, label: %s\n", number++, c->label); |
fprintf(gpoutfile, "\n# Contour %d, label: %s\n", number++, c->label); |
for (; --count >= 0; ++p) |
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 */ |
/* blank line between segments of same contour */ |
putc('\n', gpoutfile); |
putc('\n', gpoutfile); |
c = c->next; |
c = c->next; |
|
|
} |
} |
} |
} |
fflush(gpoutfile); |
fflush(gpoutfile); |
|
|
|
free(table_format); |
} |
} |
|
|
|
|
Line 1441 if(range_flags[axis]&RANGE_WRITEBACK) \ |
|
Line 1462 if(range_flags[axis]&RANGE_WRITEBACK) \ |
|
else { |
else { |
START_LEAK_CHECK(); /* assert no memory leaks here ! */ |
START_LEAK_CHECK(); /* assert no memory leaks here ! */ |
do_3dplot(first_3dplot, plot_num); |
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 */ |
/* if we get here, all went well, so record the line for replot */ |
|
|
tlen = (xp->title ? strlen(xp->title) : 0) + |
tlen = (xp->title ? strlen(xp->title) : 0) + |
(yp->title ? strlen(yp->title) : 0) + |
(yp->title ? strlen(yp->title) : 0) + |
(zp->title ? strlen(zp->title) : 0) + 5; |
(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; |
new_title[0] = 0; |
if (xp->title && xp->title[0] != '\0') { |
if (xp->title && xp->title[0] != '\0') { |
strcat(new_title, xp->title); |
strcat(new_title, xp->title); |