home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-06-18 | 30.7 KB | 1,075 lines |
- Newsgroups: comp.sources.misc
- From: woo@ra-next.arc.nasa.gov (Alex Woo)
- Subject: v30i059: gnuplot3 - interactive function plotting utility, Patch02f/7
- Message-ID: <1992Jun14.214142.8638@sparky.imd.sterling.com>
- X-Md4-Signature: 9881b0b010863c9466bd216f9d02e9e9
- Date: Sun, 14 Jun 1992 21:41:42 GMT
- Approved: kent@sparky.imd.sterling.com
-
- Submitted-by: woo@ra-next.arc.nasa.gov (Alex Woo)
- Posting-number: Volume 30, Issue 59
- Archive-name: gnuplot3/patch02f
- Environment: UNIX, MS-DOS, VMS
- Patch-To: gnuplot3: Volume 24, Issue 23-48
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then feed it
- # into a shell via "sh file" or similar. To overwrite existing files,
- # type "sh file -c".
- # The tool that generated this appeared in the comp.sources.unix newsgroup;
- # send mail to comp-sources-unix@uunet.uu.net if you want that tool.
- # Contents: patch.3
- # Wrapped by woo@ra-iris. on Thu May 28 22:44:40 1992
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- echo If this archive is complete, you will see the following message:
- echo ' "shar: End of archive 6 (of 7)."'
- if test -f 'patch.3' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patch.3'\"
- else
- echo shar: Extracting \"'patch.3'\" \(28585 characters\)
- sed "s/^X//" >'patch.3' <<'END_OF_FILE'
- Xdiff -rc gnuplot/graph3d.c gnuplot3.2/graph3d.c
- X*** gnuplot/graph3d.c Fri Sep 20 09:36:52 1991
- X--- gnuplot3.2/graph3d.c Wed Mar 25 07:59:40 1992
- X***************
- X*** 1,6 ****
- X /* GNUPLOT - graph3d.c */
- X /*
- X! * Copyright (C) 1986, 1987, 1990, 1991 Thomas Williams, Colin Kelley
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X--- 1,10 ----
- X+ #ifndef lint
- X+ static char *RCSid = "$Id: graph3d.c,v 3.26 92/03/24 22:34:27 woo Exp Locker: woo $";
- X+ #endif
- X+
- X /* GNUPLOT - graph3d.c */
- X /*
- X! * Copyright (C) 1986, 1987, 1990, 1991, 1992 Thomas Williams, Colin Kelley
- X *
- X * Permission to use, copy, and distribute this software and its
- X * documentation for any purpose with or without fee is hereby granted,
- X***************
- X*** 21,31 ****
- X * Gershon Elber and many others.
- X *
- X * Send your comments or suggestions to
- X! * pixar!info-gnuplot@sun.com.
- X * This is a mailing list; to join it send a note to
- X! * pixar!info-gnuplot-request@sun.com.
- X * Send bug reports to
- X! * pixar!bug-gnuplot@sun.com.
- X */
- X
- X #include <stdio.h>
- X--- 25,35 ----
- X * Gershon Elber and many others.
- X *
- X * Send your comments or suggestions to
- X! * info-gnuplot@ames.arc.nasa.gov.
- X * This is a mailing list; to join it send a note to
- X! * info-gnuplot-request@ames.arc.nasa.gov.
- X * Send bug reports to
- X! * bug-gnuplot@ames.arc.nasa.gov.
- X */
- X
- X #include <stdio.h>
- X***************
- X*** 46,51 ****
- X--- 50,76 ----
- X #endif
- X #endif
- X
- X+ /*
- X+ * hidden_line_type_above, hidden_line_type_below - controls type of lines
- X+ * for above and below parts of the surface.
- X+ * hidden_no_update - if TRUE lines will be hidden line removed but they
- X+ * are not assumed to be part of the surface (i.e. grid) and therefore
- X+ * do not influence the hidings.
- X+ * hidden_max_index - length of hidden_low_bound and hidden_high_bound vecs.
- X+ * hidden_first_row - TRUE if we are now drawing the first row of the surface.
- X+ * hidden_active - TRUE if hidden lines are to be removed.
- X+ * hidden_low_bound, hidden_high_bound - two vectors of size hidden_max_index
- X+ * that hold the above and below floating horisons.
- X+ */
- X+ static int hidden_line_type_above, hidden_line_type_below, hidden_no_update;
- X+ static int hidden_max_index, hidden_first_row, hidden_active = FALSE;
- X+ static int *hidden_low_bound, *hidden_high_bound;
- X+ #define HIDDEN_BOUND(x) (x < 0 ? 0 : x >= hidden_max_index ? \
- X+ hidden_max_index - 1 : x)
- X+ #define HIDDEN_LOW_BOUND(x) (hidden_low_bound[HIDDEN_BOUND(x)])
- X+ #define HIDDEN_HIGH_BOUND(x) (hidden_high_bound[HIDDEN_BOUND(x)])
- X+ #define SET_HIDDEN_BOUND(vec, x, y) (vec[HIDDEN_BOUND(x)] = y)
- X+
- X static plot3d_impulses();
- X static plot3d_lines();
- X static plot3d_points();
- X***************
- X*** 70,75 ****
- X--- 95,101 ----
- X static xtick();
- X static ytick();
- X static ztick();
- X+ static setlinestyle();
- X
- X #ifndef max /* Lattice C has max() in math.h, but shouldn't! */
- X #define max(a,b) ((a > b) ? a : b)
- X***************
- X*** 243,248 ****
- X--- 269,539 ----
- X *yt = ((int) (res[1] * yscaler / w)) + ymiddle;
- X }
- X
- X+ /* And the functions to map from user 3D space to terminal z coordinate */
- X+ static double map3d_z(x, y, z)
- X+ double x, y, z;
- X+ {
- X+ int i;
- X+ double v[4], res, /* Homogeneous coords. vectors. */
- X+ w = trans_mat[3][3];
- X+
- X+ v[0] = map_x3d(x); /* Normalize object space to -1..1 */
- X+ v[1] = map_y3d(y);
- X+ v[2] = map_z3d(z);
- X+ v[3] = 1.0;
- X+
- X+ res = trans_mat[3][2]; /* Initiate it with the weight factor. */
- X+ for (i = 0; i < 3; i++) res += v[i] * trans_mat[i][2];
- X+
- X+ return res;
- X+ }
- X+
- X+ /* Initialize the line style using the current device and set hidden styles */
- X+ /* to it as well if hidden line removal is enabled. */
- X+ static setlinestyle(style)
- X+ int style;
- X+ {
- X+ register struct termentry *t = &term_tbl[term];
- X+
- X+ (*t->linetype)(style);
- X+ if (hidden3d) {
- X+ hidden_line_type_above = style;
- X+ hidden_line_type_below = style;
- X+ }
- X+ }
- X+
- X+ /* Initialize the necessary steps for hidden line removal. This algorithm */
- X+ /* is based on the "floating horizon" explicit surfaces hidden line removal. */
- X+ static void init_hidden_line_removal()
- X+ {
- X+ hidden_max_index = xright - xleft + 1;
- X+ hidden_low_bound = (int *) alloc(sizeof(int) * hidden_max_index, "hidden");
- X+ hidden_high_bound = (int *) alloc(sizeof(int) * hidden_max_index, "hidden");
- X+ }
- X+
- X+ /* Reset the hidden line data to a fresh start. */
- X+ static void reset_hidden_line_removal()
- X+ {
- X+ int i;
- X+
- X+ for (i = 0; i < hidden_max_index; i++) {
- X+ hidden_low_bound[i] = ytop;
- X+ hidden_high_bound[i] = ybot;
- X+ }
- X+ }
- X+
- X+ /* Terminates the hidden line removal process. Free any memory allocated by */
- X+ /* init_hidden_line_removal above. */
- X+ static void term_hidden_line_removal()
- X+ {
- X+ free(hidden_low_bound);
- X+ free(hidden_high_bound);
- X+ }
- X+
- X+ /* Given a list of parallel iso_curves, make sure the first one is closest */
- X+ /* to viewer or reverse in place the list otherwise. */
- X+ /* Returns a pointer to the new ordered list. */
- X+ static struct iso_curve *reorder_hidden_one_iso_list(orig_list)
- X+ struct iso_curve *orig_list;
- X+ {
- X+ double first_crv_first_ptz, first_crv_last_ptz,
- X+ last_crv_first_ptz, last_crv_last_ptz;
- X+ struct iso_curve *first_crv = orig_list, *last_crv;
- X+
- X+ for (last_crv = first_crv; last_crv->next; last_crv = last_crv->next);
- X+
- X+ first_crv_first_ptz = map3d_z(first_crv->points[0].x,
- X+ first_crv->points[0].y,
- X+ 0.0);
- X+ first_crv_last_ptz = map3d_z(first_crv->points[first_crv->p_count-1].x,
- X+ first_crv->points[first_crv->p_count-1].y,
- X+ 0.0);
- X+
- X+ last_crv_first_ptz = map3d_z(last_crv->points[0].x,
- X+ last_crv->points[0].y,
- X+ 0.0);
- X+ last_crv_last_ptz = map3d_z(last_crv->points[last_crv->p_count-1].x,
- X+ last_crv->points[last_crv->p_count-1].y,
- X+ 0.0);
- X+
- X+ /* If first curve is in front of last - do nothing. */
- X+ if ((first_crv_first_ptz > last_crv_first_ptz &&
- X+ first_crv_first_ptz > last_crv_last_ptz) ||
- X+ (first_crv_last_ptz > last_crv_first_ptz &&
- X+ first_crv_last_ptz > last_crv_last_ptz))
- X+ return orig_list;
- X+ else {
- X+ struct iso_curve *icrv1, *icrv2, *icrv3;
- X+
- X+ /* Need to reverse the list order: */
- X+ for (icrv1 = orig_list, icrv2 = icrv1->next; icrv2 != NULL; ) {
- X+ icrv3 = icrv2->next;
- X+ icrv2->next = icrv1;
- X+ icrv1 = icrv2;
- X+ icrv2 = icrv3;
- X+ }
- X+
- X+ orig_list->next = NULL; /* Now it is the last element. */
- X+
- X+ return icrv1;
- X+ }
- X+ }
- X+
- X+ /* Reorder the list of iso_curves in the surface plot, so it will be drawn */
- X+ /* from near iso curve to far one in both direction. */
- X+ /* Returned is a pointer to new order iso curve list. */
- X+ static struct iso_curve *reorder_hidden_iso_curves(plot, num_iso_lines)
- X+ struct surface_points *plot;
- X+ int num_iso_lines;
- X+ {
- X+ int i;
- X+ struct iso_curve *iso_list1 = plot->iso_crvs, *itmp = iso_list1, *iso_list2;
- X+
- X+ for (i = 1; i < num_iso_lines; i++) itmp = itmp->next;
- X+ iso_list2 = itmp->next;
- X+ itmp->next = NULL;
- X+
- X+ iso_list1 = reorder_hidden_one_iso_list(iso_list1);
- X+ iso_list2 = reorder_hidden_one_iso_list(iso_list2);
- X+ for (itmp = iso_list1; itmp->next; itmp = itmp->next);
- X+ itmp->next = iso_list2;
- X+
- X+ plot->iso_crvs = iso_list1;
- X+
- X+ return iso_list1;
- X+ }
- X+
- X+ /* Plot a line after removing is hidden part(s). */
- X+ static void hidden_line_plot_aux(x1, y1, x2, y2, style)
- X+ int x1, y1, x2, y2, style;
- X+ {
- X+ register struct termentry *t = &term_tbl[term];
- X+
- X+ if (x2 < x1 || (x2 == x1 && y1 == y2)) return;
- X+
- X+ (*t->linetype)(style);
- X+ (*t->move)(x1,y1);
- X+ (*t->vector)(x2,y2);
- X+ }
- X+
- X+ /* Plot a line after removing is hidden part(s). */
- X+ static void hidden_line_plot(x1, y1, x2, y2)
- X+ int x1, y1, x2, y2;
- X+ {
- X+ int x, last_x, last_y, visible_above, visible_below;
- X+ float dy, y;
- X+
- X+ if (x1 > x2) {
- X+ x = x1;
- X+ x1 = x2;
- X+ x2 = x;
- X+
- X+ y = y1;
- X+ y1 = y2;
- X+ y2 = y;
- X+ }
- X+
- X+ if (hidden_first_row) {
- X+ /* All is visible and drawn as visible above. */
- X+ dy = x1 != x2 ? ((float) (y2 - y1)) / ((float) (x2 - x1)) : VERYLARGE;
- X+
- X+ for (x = x1, y = y1; x <= x2; x++, y = y1 + (x - x1) * dy) {
- X+ SET_HIDDEN_BOUND(hidden_high_bound, x, (int) y);
- X+ SET_HIDDEN_BOUND(hidden_low_bound, x, (int) y);
- X+ }
- X+ hidden_line_plot_aux(x1, y1, x2, y2, hidden_line_type_above);
- X+ }
- X+ else {
- X+ if (x1 == x2) {
- X+ if (y1 > y2) {
- X+ y = y1;
- X+ y1 = y2;
- X+ y2 = y;
- X+ }
- X+
- X+ /* Clip properly this verical line to right bounds. Note clipping
- X+ * may produce upto two segments.
- X+ */
- X+ if (y1 <= HIDDEN_LOW_BOUND(x1) && y2 <= HIDDEN_LOW_BOUND(x1))
- X+ hidden_line_plot_aux(x1, y1, x2, y2, hidden_line_type_below);
- X+ else if (y1 >= HIDDEN_HIGH_BOUND(x1) && y2 >= HIDDEN_HIGH_BOUND(x1))
- X+ hidden_line_plot_aux(x1, y1, x2, y2, hidden_line_type_above);
- X+ else {
- X+ if (y1 < HIDDEN_LOW_BOUND(x1) && y2 > HIDDEN_LOW_BOUND(x1))
- X+ hidden_line_plot_aux(x1, y1, x2, HIDDEN_LOW_BOUND(x1),
- X+ hidden_line_type_below);
- X+ if (y2 > HIDDEN_HIGH_BOUND(x1) && y1 < HIDDEN_HIGH_BOUND(x1))
- X+ hidden_line_plot_aux(x1, HIDDEN_HIGH_BOUND(x1), x2, y2,
- X+ hidden_line_type_above);
- X+ }
- X+ return;
- X+ }
- X+ else
- X+ dy = ((float) (y2 - y1)) / ((float) (x2 - x1));
- X+
- X+ visible_above = y1 >= HIDDEN_HIGH_BOUND(x1);
- X+ visible_below = y1 <= HIDDEN_LOW_BOUND(x1);
- X+ if (visible_above || visible_below) {
- X+ if (visible_above && visible_below) visible_below = FALSE;
- X+ last_x = x1;
- X+ last_y = y1;
- X+ }
- X+ for (x = x1, y = y1; x < x2; x++, y += dy)
- X+ {
- X+ if (y >= HIDDEN_HIGH_BOUND(x)) {
- X+ if (visible_below) {
- X+ hidden_line_plot_aux(last_x, last_y, x - 1, (int) (y - dy),
- X+ hidden_line_type_below);
- X+ visible_below = FALSE;
- X+ }
- X+ if (!visible_above) {
- X+ visible_above = TRUE;
- X+ last_x = x;
- X+ last_y = (int) y;
- X+ }
- X+ if (!hidden_no_update)
- X+ SET_HIDDEN_BOUND(hidden_high_bound, x, (int) y);
- X+ }
- X+ else if (y <= HIDDEN_LOW_BOUND(x)) {
- X+ if (visible_above) {
- X+ hidden_line_plot_aux(last_x, last_y, x - 1, (int) (y - dy),
- X+ hidden_line_type_above);
- X+ visible_above = FALSE;
- X+
- X+ }
- X+ if (!visible_below) {
- X+ visible_below = TRUE;
- X+ last_x = x;
- X+ last_y = (int) y;
- X+ }
- X+ if (!hidden_no_update)
- X+ SET_HIDDEN_BOUND(hidden_low_bound, x, (int) y);
- X+ }
- X+ else {
- X+ if (visible_above) {
- X+ hidden_line_plot_aux(last_x, last_y, x - 1, (int) (y - dy),
- X+ hidden_line_type_above);
- X+ visible_above = visible_below = FALSE;
- X+ }
- X+ else if (visible_below) {
- X+ hidden_line_plot_aux(last_x, last_y, x - 1, (int) (y - dy),
- X+ hidden_line_type_below);
- X+ visible_below = FALSE;
- X+ }
- X+ }
- X+ }
- X+
- X+ if (visible_above) {
- X+ hidden_line_plot_aux(last_x, last_y, x2, y2,
- X+ hidden_line_type_above);
- X+ }
- X+ else if (visible_below) {
- X+ hidden_line_plot_aux(last_x, last_y, x2, y2,
- X+ hidden_line_type_below);
- X+ }
- X+ }
- X+ }
- X+
- X /* Test a single point to be within the xleft,xright,ybot,ytop bbox.
- X * Sets the returned integers 4 l.s.b. as follows:
- X * bit 0 if to the left of xleft.
- X***************
- X*** 251,257 ****
- X * bit 3 if below of ybot.
- X * 0 is returned if inside.
- X */
- X! static int clip_point(x, y)
- X int x, y;
- X {
- X int ret_val = 0;
- X--- 542,548 ----
- X * bit 3 if below of ybot.
- X * 0 is returned if inside.
- X */
- X! static int clip_point_for_clip_line(x, y)
- X int x, y;
- X {
- X int ret_val = 0;
- X***************
- X*** 264,269 ****
- X--- 555,573 ----
- X return ret_val;
- X }
- X
- X+ /* Test a single point to be within the xleft,xright,ybot,ytop bbox.
- X+ * and it is not hidden if hidden lines are to be removed.
- X+ */
- X+ static int clip_point(x, y)
- X+ int x, y;
- X+ {
- X+ if (hidden_active &&
- X+ HIDDEN_LOW_BOUND(x) <= y && HIDDEN_HIGH_BOUND(x) >= y)
- X+ return FALSE;
- X+
- X+ return clip_point_for_clip_line(x, y);
- X+ }
- X+
- X /* Clip the given line to drawing coords defined as xleft,xright,ybot,ytop.
- X * This routine uses the cohen & sutherland bit mapping for fast clipping -
- X * see "Principles of Interactive Computer Graphics" Newman & Sproull page 65.
- X***************
- X*** 274,281 ****
- X int x, y, dx, dy, x_intr[2], y_intr[2], count, pos1, pos2;
- X register struct termentry *t = &term_tbl[term];
- X
- X! pos1 = clip_point(x1, y1);
- X! pos2 = clip_point(x2, y2);
- X if (pos1 || pos2) {
- X if (pos1 & pos2) return; /* segment is totally out. */
- X
- X--- 578,585 ----
- X int x, y, dx, dy, x_intr[2], y_intr[2], count, pos1, pos2;
- X register struct termentry *t = &term_tbl[term];
- X
- X! pos1 = clip_point_for_clip_line(x1, y1);
- X! pos2 = clip_point_for_clip_line(x2, y2);
- X if (pos1 || pos2) {
- X if (pos1 & pos2) return; /* segment is totally out. */
- X
- X***************
- X*** 359,366 ****
- X return;
- X }
- X
- X! (*t->move)(x1,y1);
- X! (*t->vector)(x2,y2);
- X }
- X
- X /* Two routine to emulate move/vector sequence using line drawing routine. */
- X--- 663,675 ----
- X return;
- X }
- X
- X! if (hidden_active) {
- X! hidden_line_plot(x1, y1, x2, y2);
- X! }
- X! else {
- X! (*t->move)(x1,y1);
- X! (*t->vector)(x2,y2);
- X! }
- X }
- X
- X /* Two routine to emulate move/vector sequence using line drawing routine. */
- X***************
- X*** 569,574 ****
- X--- 878,894 ----
- X if (fabs(z_max3d - z_min3d) < zero)
- X int_error("z_min3d should not equal z_max3d!",NO_CARET);
- X
- X+ if (hidden3d) {
- X+ struct surface_points *plot;
- X+
- X+ /* Verify data is hidden line removable - nonparametric + grid based. */
- X+ for (plot = plots; plot != NULL; plot = plot->next_sp) {
- X+ if (parametric ||
- X+ (plot->plot_type == DATA3D && !plot->has_grid_topology))
- X+ int_error("Cannot hidden line remove parametric surface or non grid data\n", NO_CARET);
- X+ }
- X+ }
- X+
- X /* INITIALIZE TERMINAL */
- X if (!term_init) {
- X (*t->init)();
- X***************
- X*** 587,592 ****
- X--- 907,913 ----
- X xscale3d = 2.0/(x_max3d - x_min3d);
- X
- X (*t->linetype)(-2); /* border linetype */
- X+
- X /* PLACE TITLE */
- X if (*title != 0) {
- X int x, y;
- X***************
- X*** 681,686 ****
- X--- 1002,1012 ----
- X (*t->arrow)(sx, sy, ex, ey, this_arrow->head);
- X }
- X
- X+ if (hidden3d) {
- X+ init_hidden_line_removal();
- X+ reset_hidden_line_removal();
- X+ hidden_active = TRUE;
- X+ }
- X
- X /* DRAW SURFACES AND CONTOURS */
- X real_z_min3d = min_z;
- X***************
- X*** 700,710 ****
- X for (surface = 0;
- X surface < pcount;
- X this_plot = this_plot->next_sp, surface++) {
- X! (*t->linetype)(this_plot->line_type+1);
- X
- X if (draw_contour && this_plot->contours != NULL) {
- X struct gnuplot_contours *cntrs = this_plot->contours;
- X
- X if (key != 0) {
- X if ((*t->justify_text)(RIGHT)) {
- X clip_put_text(xl,
- X--- 1026,1118 ----
- X for (surface = 0;
- X surface < pcount;
- X this_plot = this_plot->next_sp, surface++) {
- X! if ( hidden3d )
- X! hidden_no_update = FALSE;
- X
- X+ if (draw_surface) {
- X+ (*t->linetype)(this_plot->line_type);
- X+ if (hidden3d) {
- X+ hidden_line_type_above = this_plot->line_type;
- X+ hidden_line_type_below = this_plot->line_type + 1;
- X+ }
- X+
- X+ if (key != 0) {
- X+ if ((*t->justify_text)(RIGHT)) {
- X+ clip_put_text(xl,
- X+ yl,this_plot->title);
- X+ }
- X+ else {
- X+ if (inrange(xl-(t->h_char)*strlen(this_plot->title),
- X+ xleft, xright))
- X+ clip_put_text(xl-(t->h_char)*strlen(this_plot->title),
- X+ yl,this_plot->title);
- X+ }
- X+ }
- X+
- X+ switch(this_plot->plot_style) {
- X+ case IMPULSES: {
- X+ if (key != 0) {
- X+ clip_move(xl+(t->h_char),yl);
- X+ clip_vector(xl+4*(t->h_char),yl);
- X+ }
- X+ plot3d_impulses(this_plot);
- X+ break;
- X+ }
- X+ case LINES: {
- X+ if (key != 0) {
- X+ clip_move(xl+(int)(t->h_char),yl);
- X+ clip_vector(xl+(int)(4*(t->h_char)),yl);
- X+ }
- X+ plot3d_lines(this_plot);
- X+ break;
- X+ }
- X+ case ERRORBARS: /* ignored; treat like points */
- X+ case POINTS: {
- X+ if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
- X+ (*t->point)(xl+2*(t->h_char),yl,
- X+ this_plot->point_type);
- X+ }
- X+ plot3d_points(this_plot);
- X+ break;
- X+ }
- X+ case LINESPOINTS: {
- X+ /* put lines */
- X+ if (key != 0) {
- X+ clip_move(xl+(t->h_char),yl);
- X+ clip_vector(xl+4*(t->h_char),yl);
- X+ }
- X+ plot3d_lines(this_plot);
- X+
- X+ /* put points */
- X+ if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
- X+ (*t->point)(xl+2*(t->h_char),yl,
- X+ this_plot->point_type);
- X+ }
- X+ plot3d_points(this_plot);
- X+ break;
- X+ }
- X+ case DOTS: {
- X+ if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
- X+ (*t->point)(xl+2*(t->h_char),yl, -1);
- X+ }
- X+ plot3d_dots(this_plot);
- X+ break;
- X+ }
- X+ }
- X+ yl = yl - (t->v_char);
- X+ }
- X+
- X+ if ( hidden3d ) {
- X+ hidden_no_update = TRUE;
- X+ hidden_line_type_above = this_plot->line_type + (hidden3d ? 2 : 1);
- X+ hidden_line_type_below = this_plot->line_type + (hidden3d ? 2 : 1);
- X+ }
- X+
- X if (draw_contour && this_plot->contours != NULL) {
- X struct gnuplot_contours *cntrs = this_plot->contours;
- X
- X+ (*t->linetype)(this_plot->line_type + (hidden3d ? 2 : 1));
- X+
- X if (key != 0) {
- X if ((*t->justify_text)(RIGHT)) {
- X clip_put_text(xl,
- X***************
- X*** 769,847 ****
- X if (key != 0) yl = yl - (t->v_char);
- X }
- X
- X! if ( surface == 0 )
- X! draw_bottom_grid(this_plot,real_z_min3d,real_z_max3d);
- X!
- X! if (!draw_surface) continue;
- X! (*t->linetype)(this_plot->line_type);
- X!
- X! if (key != 0) {
- X! if ((*t->justify_text)(RIGHT)) {
- X! clip_put_text(xl,
- X! yl,this_plot->title);
- X! }
- X! else {
- X! if (inrange(xl-(t->h_char)*strlen(this_plot->title),
- X! xleft, xright))
- X! clip_put_text(xl-(t->h_char)*strlen(this_plot->title),
- X! yl,this_plot->title);
- X! }
- X! }
- X!
- X! switch(this_plot->plot_style) {
- X! case IMPULSES: {
- X! if (key != 0) {
- X! clip_move(xl+(t->h_char),yl);
- X! clip_vector(xl+4*(t->h_char),yl);
- X! }
- X! plot3d_impulses(this_plot);
- X! break;
- X! }
- X! case LINES: {
- X! if (key != 0) {
- X! clip_move(xl+(int)(t->h_char),yl);
- X! clip_vector(xl+(int)(4*(t->h_char)),yl);
- X! }
- X! plot3d_lines(this_plot);
- X! break;
- X! }
- X! case ERRORBARS: /* ignored; treat like points */
- X! case POINTS: {
- X! if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
- X! (*t->point)(xl+2*(t->h_char),yl,
- X! this_plot->point_type);
- X! }
- X! plot3d_points(this_plot);
- X! break;
- X! }
- X! case LINESPOINTS: {
- X! /* put lines */
- X! if (key != 0) {
- X! clip_move(xl+(t->h_char),yl);
- X! clip_vector(xl+4*(t->h_char),yl);
- X! }
- X! plot3d_lines(this_plot);
- X!
- X! /* put points */
- X! if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
- X! (*t->point)(xl+2*(t->h_char),yl,
- X! this_plot->point_type);
- X! }
- X! plot3d_points(this_plot);
- X! break;
- X! }
- X! case DOTS: {
- X! if (key != 0 && !clip_point(xl+2*(t->h_char),yl)) {
- X! (*t->point)(xl+2*(t->h_char),yl, -1);
- X! }
- X! plot3d_dots(this_plot);
- X! break;
- X! }
- X! }
- X! yl = yl - (t->v_char);
- X }
- X (*t->text)();
- X (void) fflush(outfile);
- X }
- X
- X /* plot3d_impulses:
- X--- 1177,1192 ----
- X if (key != 0) yl = yl - (t->v_char);
- X }
- X
- X! if (surface == 0)
- X! draw_bottom_grid(this_plot,real_z_min3d,real_z_max3d);
- X }
- X (*t->text)();
- X (void) fflush(outfile);
- X+
- X+ if (hidden3d) {
- X+ term_hidden_line_removal();
- X+ hidden_active = FALSE;
- X+ }
- X }
- X
- X /* plot3d_impulses:
- X***************
- X*** 881,895 ****
- X static plot3d_lines(plot)
- X struct surface_points *plot;
- X {
- X! int i;
- X int x,y; /* point in terminal coordinates */
- X struct termentry *t = &term_tbl[term];
- X! struct iso_curve *icrvs = plot->iso_crvs;
- X
- X! while ( icrvs ) {
- X! struct coordinate *points = icrvs->points;
- X
- X! for (i = 0; i < icrvs->p_count; i++) {
- X if (real_z_max3d<points[i].z)
- X real_z_max3d=points[i].z;
- X if (real_z_min3d>points[i].z)
- X--- 1226,1280 ----
- X static plot3d_lines(plot)
- X struct surface_points *plot;
- X {
- X! int i, iso_count, num_iso_lines;
- X int x,y; /* point in terminal coordinates */
- X struct termentry *t = &term_tbl[term];
- X! struct iso_curve *icrvs = plot->iso_crvs,
- X! *first_row_icrv, *last_row_icrv, *first_col_icrv, *icrv;
- X! struct coordinate *points;
- X
- X! if (hidden3d) {
- X! hidden_no_update = FALSE;
- X
- X! if (plot->plot_type == FUNC3D)
- X! num_iso_lines = iso_samples;
- X! else
- X! num_iso_lines = plot->num_iso_read;
- X!
- X! icrvs = reorder_hidden_iso_curves(plot, num_iso_lines);
- X!
- X! first_row_icrv = icrvs;
- X! for (last_row_icrv = icrvs, i = 1;
- X! i++ < num_iso_lines;
- X! last_row_icrv = last_row_icrv->next);
- X! first_col_icrv = last_row_icrv->next;
- X! reset_hidden_line_removal();
- X!
- X! iso_count = 1;
- X! }
- X!
- X! while (icrvs) {
- X! if (hidden3d) {
- X! if (iso_count == 1 || iso_count == num_iso_lines + 1) {
- X! hidden_first_row = TRUE;
- X!
- X! /* Draw other boundary so low/high bounds will be complete: */
- X! icrv = iso_count == 1 ? first_col_icrv : first_row_icrv;
- X! for (i = 0, points = icrv->points; i < icrv->p_count; i++) {
- X! map3d_xy(points[i].x, points[i].y, points[i].z, &x, &y);
- X!
- X! if (i > 0)
- X! clip_vector(x,y);
- X! else
- X! clip_move(x,y);
- X! }
- X! }
- X! else
- X! hidden_first_row = FALSE;
- X! iso_count++;
- X! }
- X!
- X! for (i = 0, points = icrvs->points; i < icrvs->p_count; i++) {
- X if (real_z_max3d<points[i].z)
- X real_z_max3d=points[i].z;
- X if (real_z_min3d>points[i].z)
- X***************
- X*** 905,910 ****
- X--- 1290,1308 ----
- X
- X icrvs = icrvs->next;
- X }
- X+
- X+ if (hidden3d) {
- X+ /* Draw other boundary so low/high bounds will be complete: */
- X+ for (i = 0, points = last_row_icrv->points;
- X+ i < last_row_icrv->p_count; i++) {
- X+ map3d_xy(points[i].x, points[i].y, points[i].z, &x, &y);
- X+
- X+ if (i > 0)
- X+ clip_vector(x,y);
- X+ else
- X+ clip_move(x,y);
- X+ }
- X+ }
- X }
- X
- X /* plot3d_points:
- X***************
- X*** 1165,1174 ****
- X dy = (y_max3d-y_min3d) / (grid_iso-1);
- X
- X for (i = 0; i < grid_iso; i++) {
- X! if (i == 0 || i == grid_iso-1)
- X! (*t->linetype)(-2);
- X else
- X! (*t->linetype)(-1);
- X map3d_xy(x_min3d, y, z_min3d, &ix, &iy);
- X clip_move(ix,iy);
- X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
- X--- 1563,1572 ----
- X dy = (y_max3d-y_min3d) / (grid_iso-1);
- X
- X for (i = 0; i < grid_iso; i++) {
- X! if (i == 0 || i == grid_iso-1)
- X! setlinestyle(-2);
- X else
- X! setlinestyle(-1);
- X map3d_xy(x_min3d, y, z_min3d, &ix, &iy);
- X clip_move(ix,iy);
- X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
- X***************
- X*** 1184,1192 ****
- X
- X for (i = 0; i < grid_iso; i++) {
- X if (i == 0 || i == grid_iso-1)
- X! (*t->linetype)(-2);
- X else
- X! (*t->linetype)(-1);
- X map3d_xy(x, y_min3d, z_min3d, &ix, &iy);
- X clip_move(ix,iy);
- X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
- X--- 1582,1590 ----
- X
- X for (i = 0; i < grid_iso; i++) {
- X if (i == 0 || i == grid_iso-1)
- X! setlinestyle(-2);
- X else
- X! setlinestyle(-1);
- X map3d_xy(x, y_min3d, z_min3d, &ix, &iy);
- X clip_move(ix,iy);
- X update_extrema_pts(ix,iy,&min_sx_x,&min_sx_y,
- X***************
- X*** 1201,1207 ****
- X }
- X }
- X else {
- X! (*t->linetype)(-2);
- X
- X map3d_xy(x_min3d, y_min3d, z_min3d, &ix, &iy);
- X clip_move(ix,iy);
- X--- 1599,1605 ----
- X }
- X }
- X else {
- X! setlinestyle(-2);
- X
- X map3d_xy(x_min3d, y_min3d, z_min3d, &ix, &iy);
- X clip_move(ix,iy);
- X***************
- X*** 1245,1258 ****
- X
- X while ( icrvs ) {
- X struct coordinate *points = icrvs->points;
- X
- X for (i = 0; i < icrvs->p_count; i += icrvs->p_count-1) {
- X map3d_xy(points[i].x, points[i].y, z_min3d, &x, &y);
- X if (is_boundary) {
- X! (*t->linetype)(-2);
- X }
- X else {
- X! (*t->linetype)(-1);
- X }
- X
- X if (i > 0) {
- X--- 1643,1660 ----
- X
- X while ( icrvs ) {
- X struct coordinate *points = icrvs->points;
- X+ int saved_hidden_active = hidden_active;
- X+ double z1 = map3d_z(points[0].x, points[0].y, 0.0),
- X+ z2 = map3d_z(points[icrvs->p_count-1].x,
- X+ points[icrvs->p_count-1].y, 0.0);
- X
- X for (i = 0; i < icrvs->p_count; i += icrvs->p_count-1) {
- X map3d_xy(points[i].x, points[i].y, z_min3d, &x, &y);
- X if (is_boundary) {
- X! setlinestyle(-2);
- X }
- X else {
- X! setlinestyle(-1);
- X }
- X
- X if (i > 0) {
- X***************
- X*** 1269,1276 ****
- X--- 1671,1685 ----
- X
- X /* Draw a vertical line to surface corner from grid corner. */
- X map3d_xy(points[i].x, points[i].y, points[i].z, &x1, &y1);
- X+ if (hidden3d) {
- X+ if ((i == 0 && z1 > z2) ||
- X+ (i == icrvs->p_count-1 && z2 > z1)) {
- X+ hidden_active = FALSE; /* This one is always visible. */
- X+ }
- X+ }
- X clip_vector(x1,y1);
- X clip_move(x,y);
- X+ hidden_active = saved_hidden_active;
- X update_extrema_pts(x,y,&min_sx_x,&min_sx_y, &min_sy_x,&min_sy_y,
- X points[i].x,points[i].y);
- X }
- X***************
- X*** 1324,1330 ****
- X else
- X draw_non_param_grid(plot);
- X
- X! (*t->linetype)(-2); /* border linetype */
- X
- X /* label x axis tics */
- X if (xtics && xtic > 0.0) {
- X--- 1733,1739 ----
- X else
- X draw_non_param_grid(plot);
- X
- X! setlinestyle(-2); /* border linetype */
- X
- X /* label x axis tics */
- X if (xtics && xtic > 0.0) {
- X***************
- X*** 1557,1563 ****
- X }
- X
- X /* Make sure the vertical line is fully drawn. */
- X! (*t->linetype)(-2); /* axis line type */
- X
- X map3d_xy(xpos, ypos, z_min3d, &x, &y);
- X clip_move(x,y);
- X--- 1966,1972 ----
- X }
- X
- X /* Make sure the vertical line is fully drawn. */
- X! setlinestyle(-2); /* axis line type */
- X
- X map3d_xy(xpos, ypos, z_min3d, &x, &y);
- X clip_move(x,y);
- X***************
- X*** 1564,1570 ****
- X map3d_xy(xpos, ypos, min(end,z_max)+(log_z ? incr : 0.0), &x, &y);
- X clip_vector(x,y);
- X
- X! (*t->linetype)(-1); /* border linetype */
- X }
- X
- X /* DRAW_SERIES_3DXTICS: draw a user tic series, x axis */
- X--- 1973,1979 ----
- X map3d_xy(xpos, ypos, min(end,z_max)+(log_z ? incr : 0.0), &x, &y);
- X clip_vector(x,y);
- X
- X! setlinestyle(-1); /* border linetype */
- X }
- X
- X /* DRAW_SERIES_3DXTICS: draw a user tic series, x axis */
- X***************
- X*** 1651,1657 ****
- X }
- X
- X /* Make sure the vertical line is fully drawn. */
- X! (*t->linetype)(-2); /* axis line type */
- X
- X map3d_xy(xpos, ypos, z_min3d, &x, &y);
- X clip_move(x,y);
- X--- 2060,2066 ----
- X }
- X
- X /* Make sure the vertical line is fully drawn. */
- X! setlinestyle(-2); /* axis line type */
- X
- X map3d_xy(xpos, ypos, z_min3d, &x, &y);
- X clip_move(x,y);
- X***************
- X*** 1658,1664 ****
- X map3d_xy(xpos, ypos, min(end,z_max)+(log_z ? incr : 0.0), &x, &y);
- X clip_vector(x,y);
- X
- X! (*t->linetype)(-1); /* border linetype */
- X }
- X
- X /* DRAW_SET_3DXTICS: draw a user tic set, x axis */
- X--- 2067,2073 ----
- X map3d_xy(xpos, ypos, min(end,z_max)+(log_z ? incr : 0.0), &x, &y);
- X clip_vector(x,y);
- X
- X! setlinestyle(-1); /* border linetype */
- X }
- X
- X /* DRAW_SET_3DXTICS: draw a user tic set, x axis */
- X***************
- X*** 1722,1728 ****
- X }
- X
- X /* Make sure the vertical line is fully drawn. */
- X! (*t->linetype)(-2); /* axis line type */
- X
- X map3d_xy(xpos, ypos, z_min, &x, &y);
- X clip_move(x,y);
- X--- 2131,2137 ----
- X }
- X
- X /* Make sure the vertical line is fully drawn. */
- X! setlinestyle(-2); /* axis line type */
- X
- X map3d_xy(xpos, ypos, z_min, &x, &y);
- X clip_move(x,y);
- X***************
- X*** 1729,1735 ****
- X map3d_xy(xpos, ypos, z_max+(log_z ? incr : 0.0), &x, &y);
- X clip_vector(x,y);
- X
- X! (*t->linetype)(-1); /* border linetype */
- X }
- X
- X /* draw and label a x-axis ticmark */
- X--- 2138,2144 ----
- X map3d_xy(xpos, ypos, z_max+(log_z ? incr : 0.0), &x, &y);
- X clip_vector(x,y);
- X
- X! setlinestyle(-1); /* border linetype */
- X }
- X
- X /* draw and label a x-axis ticmark */
- END_OF_FILE
- if test 28585 -ne `wc -c <'patch.3'`; then
- echo shar: \"'patch.3'\" unpacked with wrong size!
- fi
- # end of 'patch.3'
- fi
- echo shar: End of archive 6 \(of 7\).
- cp /dev/null ark6isdone
- MISSING=""
- for I in 1 2 3 4 5 6 7 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 7 archives.
- rm -f ark[1-9]isdone
- else
- echo You still must unpack the following archives:
- echo " " ${MISSING}
- fi
- exit 0
-
- exit 0 # Just in case...
-