=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/Attic/graph3d.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/graph3d.c 2000/01/22 14:15:58 1.1.1.2 +++ OpenXM_contrib/gnuplot/Attic/graph3d.c 2003/09/15 07:09:25 1.1.1.3 @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: graph3d.c,v 1.1.1.2 2000/01/22 14:15:58 maekawa Exp $"; +static char *RCSid = "$Id: graph3d.c,v 1.1.1.3 2003/09/15 07:09:25 ohara Exp $"; #endif /* GNUPLOT - graph3d.c */ @@ -95,12 +95,13 @@ static void check_corner_height __PROTO((struct coordi double height[2][2], double depth[2][2])); static void draw_bottom_grid __PROTO((struct surface_points * plot, int plot_count)); -static void xtick_callback __PROTO((int axis, double place, char *text, - struct lp_style_type grid)); -static void ytick_callback __PROTO((int axis, double place, char *text, - struct lp_style_type grid)); -static void ztick_callback __PROTO((int axis, double place, char *text, - struct lp_style_type grid)); +/* HBB 20010118: these should be static, but can't --- HP-UX assembler bug */ +void xtick_callback __PROTO((int axis, double place, char *text, + struct lp_style_type grid)); +void ytick_callback __PROTO((int axis, double place, char *text, + struct lp_style_type grid)); +void ztick_callback __PROTO((int axis, double place, char *text, + struct lp_style_type grid)); static void setlinestyle __PROTO((struct lp_style_type style)); static void boundary3d __PROTO((int scaling, struct surface_points * plots, @@ -231,7 +232,6 @@ static double back_x, back_y; static double tic_unitx, tic_unity; /* (DFK) Watch for cancellation error near zero on axes labels */ -#define SIGNIF (0.01) /* less than one hundredth of a tic mark */ #define CheckZero(x,tic) (fabs(x) < ((tic) * SIGNIF) ? 0.0 : (x)) #define NearlyEqual(x,y,tic) (fabs((x)-(y)) < ((tic) * SIGNIF)) @@ -417,7 +417,7 @@ int count; /* an absolute 1, with no terminal-dependent scaling ? */ ybot = (t->v_char) * 2.5 + 1; - if (key_rows && key_vpos == TUNDER) + if (key_rows && key == -1 && key_vpos == TUNDER) /* HBB 20000328 */ ybot += key_rows * key_entry_height + ktitle_lines * t->v_char; if (strlen(title.text)) { @@ -509,15 +509,6 @@ int pcount; /* count of plots in linked list */ mat_scale(surface_scale / 2.0, surface_scale / 2.0, surface_scale / 2.0, mat); mat_mult(trans_mat, trans_mat, mat); -#if 0 - /* HBB 19990609: this is *not* the way to implement 'set view' */ - /* modify min_z/max_z so it will zscale properly. */ - ztemp = (z_max3d - z_min3d) / (2.0 * surface_zscale); - temp = (z_max3d + z_min3d) / 2.0; - z_min3d = temp - ztemp; - z_max3d = temp + ztemp; -#endif /* 0 */ - /* The extrema need to be set even when a surface is not being * drawn. Without this, gnuplot used to assume that the X and * Y axis started at zero. -RKC @@ -835,7 +826,7 @@ int pcount; /* count of plots in linked list */ case FINANCEBARS: case VECTOR: case POINTSTYLE: - if (lkey && !clip_point(xl + key_point_offset, yl)) { + if (lkey) { key_sample_point(xl, yl, this_plot->lp_properties.p_type); } if (!(hidden3d && draw_surface)) @@ -851,7 +842,7 @@ int pcount; /* count of plots in linked list */ plot3d_lines(this_plot); /* put points */ - if (lkey && !clip_point(xl + key_point_offset, yl)) + if (lkey) key_sample_point(xl, yl, this_plot->lp_properties.p_type); if (!(hidden3d && draw_surface)) @@ -1705,7 +1696,10 @@ else if (height[i][j] != depth[i][j]) \ } -static void xtick_callback(axis, place, text, grid) +/* HBB 20010118: all the *_callback() functions made non-static. This + * is necessary to work around a bug in HP's assembler shipped with + * HP-UX 10 and higher, if GCC tries to use it */ +void xtick_callback(axis, place, text, grid) int axis; double place; char *text; @@ -1761,7 +1755,7 @@ struct lp_style_type grid; /* linetype or -2 for none } } -static void ytick_callback(axis, place, text, grid) +void ytick_callback(axis, place, text, grid) int axis; double place; char *text; @@ -1815,7 +1809,7 @@ struct lp_style_type grid; } } -static void ztick_callback(axis, place, text, grid) +void ztick_callback(axis, place, text, grid) int axis; double place; char *text; @@ -1911,8 +1905,10 @@ char *what; graph_error("Cannot mix screen co-ordinates with other types"); } { register struct termentry *t = term; - *x = pos->x * (t->xmax) + 0.5; - *y = pos->y * (t->ymax) + 0.5; + /* HBB 20000914: off-by-one bug. Maximum allowed output is + * t->?max - 1, not t->?max itself! */ + *x = pos->x * (t->xmax -1) + 0.5; + *y = pos->y * (t->ymax -1) + 0.5; } return; @@ -1970,9 +1966,17 @@ static void key_sample_point(xl, yl, pointtype) int xl, yl; int pointtype; { - if (!clip_point(xl + key_point_offset, yl)) { - (*term->point) (xl + key_point_offset, yl, pointtype); - } else { + /* HBB 20000412: fixed incorrect clipping: the point sample was + * clipped against the graph box, even if in 'below' or 'outside' + * position. But the result of that clipping was utterly ignored, + * because the 'else' part did exactly the same thing as the + * 'then' one. Some callers of this routine thus did their own + * clipping, which I removed, along with this change. + * + * Now, all 'automatically' placed cases will never be clipped, + * only user-specified ones. */ + if ((key == -1) /* ==-1 means auto-placed key */ + || !clip_point(xl + key_point_offset, yl)) { (*term->point) (xl + key_point_offset, yl, pointtype); } }