[BACK]Return to graph3d.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot

Diff for /OpenXM_contrib/gnuplot/Attic/graph3d.c between version 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2000/01/09 17:00:51 version 1.1.1.2, 2000/01/22 14:15:58
Line 397  int count;
Line 397  int count;
     key_rows = ptitl_cnt;      key_rows = ptitl_cnt;
     key_cols = 1;      key_cols = 1;
     if (key == -1 && key_vpos == TUNDER) {      if (key == -1 && key_vpos == TUNDER) {
         if (ptitl_cnt > 0) {
         /* calculate max no cols, limited by label-length */          /* calculate max no cols, limited by label-length */
         key_cols = (int) (xright - xleft) / ((max_ptitl_len + 4) * (t->h_char) + key_sample_width);          key_cols = (int) (xright - xleft) / ((max_ptitl_len + 4) * (t->h_char) + key_sample_width);
           /* HBB 991019: fix division by zero problem */
           if (key_cols == 0)
               key_cols = 1;
         key_rows = (int) (ptitl_cnt / key_cols) + ((ptitl_cnt % key_cols) > 0);          key_rows = (int) (ptitl_cnt / key_cols) + ((ptitl_cnt % key_cols) > 0);
         /* now calculate actual no cols depending on no rows */          /* now calculate actual no cols depending on no rows */
         key_cols = (int) (ptitl_cnt / key_rows) + ((ptitl_cnt % key_rows) > 0);          key_cols = (int) (ptitl_cnt / key_rows) + ((ptitl_cnt % key_rows) > 0);
         key_col_wth = (int) (xright - xleft) / key_cols;          key_col_wth = (int) (xright - xleft) / key_cols;
         /* key_rows += ktitle_lines; - messes up key - div */          /* key_rows += ktitle_lines; - messes up key - div */
         } else {
           key_rows = key_cols = key_col_wth = 0;
         }
     }      }
     /* this should also consider the view and number of lines in      /* this should also consider the view and number of lines in
      * xformat || yformat || xlabel || ylabel */       * xformat || yformat || xlabel || ylabel */
Line 443  int count;
Line 450  int count;
     /* HBB 980308: sigh... another 16bit glitch: on term's with more than      /* HBB 980308: sigh... another 16bit glitch: on term's with more than
      * 8000 pixels in either direction, these calculations produce garbage       * 8000 pixels in either direction, these calculations produce garbage
      * results if done in (16bit) ints */       * results if done in (16bit) ints */
     xscaler = (xright - xleft) * 4 / 7;         /* HBB: Magic number alert! */      xscaler = ((xright - xleft) * 4L) / 7L;              /* HBB: Magic number alert! */
     yscaler = ((ytop - ybot) * 4L) / 7L;      yscaler = ((ytop - ybot) * 4L) / 7L;
   
 }  }
Line 487  int pcount;   /* count of plots in linked list */
Line 494  int pcount;   /* count of plots in linked list */
     struct surface_points *this_plot = NULL;      struct surface_points *this_plot = NULL;
     unsigned int xl, yl;      unsigned int xl, yl;
     int linetypeOffset = 0;      int linetypeOffset = 0;
     double ztemp, temp;      /* double ztemp, temp; unused */
     struct text_label *this_label;      struct text_label *this_label;
     struct arrow_def *this_arrow;      struct arrow_def *this_arrow;
     TBOOLEAN scaling;      TBOOLEAN scaling;
     transform_matrix mat;      transform_matrix mat;
     int key_count;      int key_count;
     char ss[MAX_LINE_LEN+1], *s, *e;      char *s, *e;
   
     /* Initiate transformation matrix using the global view variables. */      /* Initiate transformation matrix using the global view variables. */
     mat_rot_z(surface_rot_z, trans_mat);      mat_rot_z(surface_rot_z, trans_mat);
Line 502  int pcount;   /* count of plots in linked list */
Line 509  int pcount;   /* count of plots in linked list */
     mat_scale(surface_scale / 2.0, surface_scale / 2.0, surface_scale / 2.0, mat);      mat_scale(surface_scale / 2.0, surface_scale / 2.0, surface_scale / 2.0, mat);
     mat_mult(trans_mat, trans_mat, mat);      mat_mult(trans_mat, trans_mat, mat);
   
   #if 0
       /* HBB 19990609: this is *not* the way to implement 'set view' <z_scale> */
     /* modify min_z/max_z so it will zscale properly. */      /* modify min_z/max_z so it will zscale properly. */
     ztemp = (z_max3d - z_min3d) / (2.0 * surface_zscale);      ztemp = (z_max3d - z_min3d) / (2.0 * surface_zscale);
     temp = (z_max3d + z_min3d) / 2.0;      temp = (z_max3d + z_min3d) / 2.0;
     z_min3d = temp - ztemp;      z_min3d = temp - ztemp;
     z_max3d = temp + ztemp;      z_max3d = temp + ztemp;
   #endif /* 0 */
   
   
     /* The extrema need to be set even when a surface is not being      /* The extrema need to be set even when a surface is not being
      * drawn.   Without this, gnuplot used to assume that the X and       * drawn.   Without this, gnuplot used to assume that the X and
      * Y axis started at zero.   -RKC       * Y axis started at zero.   -RKC
Line 573  int pcount;   /* count of plots in linked list */
Line 582  int pcount;   /* count of plots in linked list */
     boundary3d(scaling, plots, pcount);      boundary3d(scaling, plots, pcount);
   
     /* SCALE FACTORS */      /* SCALE FACTORS */
     zscale3d = 2.0 / (ceiling_z - floor_z);      zscale3d = 2.0 / (ceiling_z - floor_z) * surface_zscale;
     yscale3d = 2.0 / (y_max3d - y_min3d);      yscale3d = 2.0 / (y_max3d - y_min3d);
     xscale3d = 2.0 / (x_max3d - x_min3d);      xscale3d = 2.0 / (x_max3d - x_min3d);
   
Line 581  int pcount;   /* count of plots in linked list */
Line 590  int pcount;   /* count of plots in linked list */
   
     /* PLACE TITLE */      /* PLACE TITLE */
     if (*title.text != 0) {      if (*title.text != 0) {
         safe_strncpy(ss, title.text, sizeof(ss));  
         write_multiline((unsigned int) ((xleft + xright) / 2 + title.xoffset * t->h_char),          write_multiline((unsigned int) ((xleft + xright) / 2 + title.xoffset * t->h_char),
                         (unsigned int) (ytop + (titlelin + title.yoffset) * (t->h_char)),                          (unsigned int) (ytop + (titlelin + title.yoffset) * (t->h_char)),
                         ss, CENTRE, JUST_TOP, 0, title.font);                          title.text, CENTRE, JUST_TOP, 0, title.font);
     }      }
     /* PLACE TIMEDATE */      /* PLACE TIMEDATE */
     if (*timelabel.text) {      if (*timelabel.text) {
Line 619  int pcount;   /* count of plots in linked list */
Line 627  int pcount;   /* count of plots in linked list */
   
   
         map_position(&this_label->place, &x, &y, "label");          map_position(&this_label->place, &x, &y, "label");
         safe_strncpy(ss, this_label->text, sizeof(ss));  
         if (this_label->rotate && (*t->text_angle) (1)) {          if (this_label->rotate && (*t->text_angle) (1)) {
             write_multiline(x, y, this_label->text, this_label->pos, CENTRE, 1, this_label->font);              write_multiline(x, y, this_label->text, this_label->pos, CENTRE, 1, this_label->font);
             (*t->text_angle) (0);              (*t->text_angle) (0);
Line 675  int pcount;   /* count of plots in linked list */
Line 682  int pcount;   /* count of plots in linked list */
             xl /= 1000;              xl /= 1000;
             xl += xleft;              xl += xleft;
 #else  #else
               /* HBB 19990608: why calculate these again? boundary3d has already
                * done it... */
               if (ptitl_cnt > 0) {
             /* maximise no cols, limited by label-length */              /* maximise no cols, limited by label-length */
             key_cols = (int) (xright - xleft) / key_col_wth;              key_cols = (int) (xright - xleft) / key_col_wth;
             key_rows = (int) (ptitl_cnt + key_cols - 1) / key_cols;              key_rows = (int) (ptitl_cnt + key_cols - 1) / key_cols;
Line 689  int pcount;   /* count of plots in linked list */
Line 699  int pcount;   /* count of plots in linked list */
              */               */
             xl = xleft + ((xright - xleft) * key_size_left) / (key_cols * (key_size_left + key_size_right));              xl = xleft + ((xright - xleft) * key_size_left) / (key_cols * (key_size_left + key_size_right));
             yl = yoffset * t->ymax + (key_rows) * key_entry_height + (ktitle_lines + 2) * t->v_char;              yl = yoffset * t->ymax + (key_rows) * key_entry_height + (ktitle_lines + 2) * t->v_char;
               }
 #endif  #endif
         } else {          } else {
             if (key_vpos == TTOP) {              if (key_vpos == TTOP) {
Line 735  int pcount;   /* count of plots in linked list */
Line 746  int pcount;   /* count of plots in linked list */
   
     /* KEY TITLE */      /* KEY TITLE */
     if (key != 0 && strlen(key_title)) {      if (key != 0 && strlen(key_title)) {
         sprintf(ss, "%s\n", key_title);          char *ss = gp_alloc(strlen(key_title) + 2, "tmp string ss");
           strcpy(ss, key_title);
           strcat(ss, "\n");
         s = ss;          s = ss;
         yl -= t->v_char / 2;          yl -= t->v_char / 2;
         while ((e = (char *) strchr(s, '\n')) != NULL) {          while ((e = (char *) strchr(s, '\n')) != NULL) {
Line 757  int pcount;   /* count of plots in linked list */
Line 770  int pcount;   /* count of plots in linked list */
             yl -= t->v_char;              yl -= t->v_char;
         }          }
         yl += t->v_char / 2;          yl += t->v_char / 2;
           free(ss);
     }      }
     key_count = 0;      key_count = 0;
     yl_ref = yl -= key_entry_height / 2;        /* centralise the keys */      yl_ref = yl -= key_entry_height / 2;        /* centralise the keys */
Line 1618  else if (height[i][j] != depth[i][j]) \
Line 1632  else if (height[i][j] != depth[i][j]) \
                 y1 -= tic_unity * ticscale * (t->v_tic);                  y1 -= tic_unity * ticscale * (t->v_tic);
             }              }
             /* write_multiline mods it */              /* write_multiline mods it */
             safe_strncpy(ss, xlabel.text, sizeof(ss));              write_multiline(x1, y1, xlabel.text, CENTRE, JUST_TOP, 0, xlabel.font);
             write_multiline(x1, y1, ss, CENTRE, JUST_TOP, 0, xlabel.font);  
         }          }
     }      }
     if (ytics || *ylabel.text) {      if (ytics || *ylabel.text) {
Line 1665  else if (height[i][j] != depth[i][j]) \
Line 1678  else if (height[i][j] != depth[i][j]) \
         gen_tics(FIRST_Z_AXIS, &zticdef, work_grid.l_type & (GRID_Z | GRID_MZ),          gen_tics(FIRST_Z_AXIS, &zticdef, work_grid.l_type & (GRID_Z | GRID_MZ),
                  mztics, mztfreq, ztick_callback);                   mztics, mztfreq, ztick_callback);
     }      }
     if ((xzeroaxis.l_type >= -2) && !is_log_y && inrange(0, y_min3d, y_max3d)) {      if ((yzeroaxis.l_type >= -2) && !is_log_x && inrange(0, x_min3d, x_max3d)) {
         unsigned int x, y, x1, y1;          unsigned int x, y, x1, y1;
         term_apply_lp_properties(&xzeroaxis);          term_apply_lp_properties(&yzeroaxis);
         map3d_xy(0.0, y_min3d, base_z, &x, &y);         /* line through x=0 */          map3d_xy(0.0, y_min3d, base_z, &x, &y);         /* line through x=0 */
         map3d_xy(0.0, y_max3d, base_z, &x1, &y1);          map3d_xy(0.0, y_max3d, base_z, &x1, &y1);
         draw_clip_line(x, y, x1, y1);          draw_clip_line(x, y, x1, y1);
     }      }
     if ((yzeroaxis.l_type >= -2) && !is_log_x && inrange(0, x_min3d, x_max3d)) {      if ((xzeroaxis.l_type >= -2) && !is_log_y && inrange(0, y_min3d, y_max3d)) {
         unsigned int x, y, x1, y1;          unsigned int x, y, x1, y1;
         term_apply_lp_properties(&yzeroaxis);          term_apply_lp_properties(&xzeroaxis);
         map3d_xy(x_min3d, 0.0, base_z, &x, &y);         /* line through y=0 */          map3d_xy(x_min3d, 0.0, base_z, &x, &y);         /* line through y=0 */
         map3d_xy(x_max3d, 0.0, base_z, &x1, &y1);          map3d_xy(x_max3d, 0.0, base_z, &x1, &y1);
         draw_clip_line(x, y, x1, y1);          draw_clip_line(x, y, x1, y1);
Line 1686  else if (height[i][j] != depth[i][j]) \
Line 1699  else if (height[i][j] != depth[i][j]) \
         x += zlabel.xoffset * t->h_char;          x += zlabel.xoffset * t->h_char;
         y += zlabel.yoffset * t->v_char;          y += zlabel.yoffset * t->v_char;
   
         safe_strncpy(ss, zlabel.text, sizeof(ss));          write_multiline(x, y, zlabel.text, CENTRE, CENTRE, 0, zlabel.font);
         write_multiline(x, y, ss, CENTRE, CENTRE, 0, zlabel.font);  
   
     }      }
 }  }

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>