Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for dead/diplomovka/xgrafix/src/xgprint.c between version 1.3 and 1.4

version 1.3, 2002/09/04 23:17:20 version 1.4, 2002/09/04 23:37:02
Line 22  extern void BXG_Write_3D(DataType theDat
Line 22  extern void BXG_Write_3D(DataType theDat
 extern void  BXG_Write_Vector(DataType theData,LabelType theLabel, StructType *structs,char *filename,char *type, double *theTimeStep);  extern void  BXG_Write_Vector(DataType theData,LabelType theLabel, StructType *structs,char *filename,char *type, double *theTimeStep);
   
 void PaintWall(MeshType *theBox, SCALAR c1, SCALAR d1, SCALAR c2, SCALAR d2,  void PaintWall(MeshType *theBox, SCALAR c1, SCALAR d1, SCALAR c2, SCALAR d2,
                                                 int wall, int side, FILE *fp)                  int wall, int side, FILE *fp)
 { // {{{  { // {{{
         XPoint          thePoint[4];          XPoint          thePoint[4];
   
Line 88  void PaintWall(MeshType *theBox, SCALAR
Line 88  void PaintWall(MeshType *theBox, SCALAR
         }          }
         if (side == BACK)          if (side == BACK)
                 fprintf(fp, "%d %d %d %d %d %d %d %d bbwfpoly\n",                  fprintf(fp, "%d %d %d %d %d %d %d %d bbwfpoly\n",
                                                                 thePoint[0].x, thePoint[0].y, thePoint[1].x, thePoint[1].y,                                  thePoint[0].x, thePoint[0].y, thePoint[1].x, thePoint[1].y,
                                                                 thePoint[2].x, thePoint[2].y, thePoint[3].x, thePoint[3].y);                                  thePoint[2].x, thePoint[2].y, thePoint[3].x, thePoint[3].y);
         else          else
                 fprintf(fp, "%d %d %d %d %d %d %d %d poly\n",                  fprintf(fp, "%d %d %d %d %d %d %d %d poly\n",
                                                                 thePoint[0].x, thePoint[0].y, thePoint[1].x, thePoint[1].y,                                  thePoint[0].x, thePoint[0].y, thePoint[1].x, thePoint[1].y,
                                                                 thePoint[2].x, thePoint[2].y, thePoint[3].x, thePoint[3].y);                                  thePoint[2].x, thePoint[2].y, thePoint[3].x, thePoint[3].y);
 } // }}}  } // }}}
   
 void PostScriptOpenWindow(WindowType theWindow, char *eps_file_name,  void PostScriptOpenWindow(WindowType theWindow, char *eps_file_name,
                                                 char *plot_title)                  char *plot_title)
 { // {{{  { // {{{
         DataType        data_Ptr, ptr;          DataType        data_Ptr, ptr;
         LabelType       label_Ptr;          LabelType       label_Ptr;
Line 131  void PostScriptOpenWindow(WindowType the
Line 131  void PostScriptOpenWindow(WindowType the
         /************************************************/          /************************************************/
         /* Limits of the bounding box (PS and physical) */          /* Limits of the bounding box (PS and physical) */
   
         fprintf(fp, "%%Limits of the bounding box (PS and physical)\n");          fprintf(fp, "%%Limits of the bounding box (PS and physical)\n");
         fprintf(fp, "/xps1 %d def\n",x1);          fprintf(fp, "/xps1 %d def\n",x1);
         fprintf(fp, "/yps1 %d def\n",y1);          fprintf(fp, "/yps1 %d def\n",y1);
         fprintf(fp, "/xps2 %d def\n",x2);          fprintf(fp, "/xps2 %d def\n",x2);
         fprintf(fp, "/yps2 %d def\n",y2);          fprintf(fp, "/yps2 %d def\n",y2);
         fprintf(fp, "/xmin %.6G def\n", label_Ptr->X_Min);          fprintf(fp, "/xmin %.6G def\n", label_Ptr->X_Min);
         fprintf(fp, "/xmax %.6G def\n", label_Ptr->X_Max);          fprintf(fp, "/xmax %.6G def\n", label_Ptr->X_Max);
         fprintf(fp, "/xscale %.6G def\n", label_Ptr->X_Scale);          fprintf(fp, "/xscale %.6G def\n", label_Ptr->X_Scale);
         fprintf(fp, "/ymin %.6G def\n", label_Ptr->Y_Min);          fprintf(fp, "/ymin %.6G def\n", label_Ptr->Y_Min);
         fprintf(fp, "/ymax %.6G def\n", label_Ptr->Y_Max);          fprintf(fp, "/ymax %.6G def\n", label_Ptr->Y_Max);
         fprintf(fp, "/yscale %.6G def\n\n", label_Ptr->Y_Scale);          fprintf(fp, "/yscale %.6G def\n\n", label_Ptr->Y_Scale);
   
         /*****************/          /*****************/
         /* Draw boundary */          /* Draw boundary */
   
         fprintf(fp, "%%Draw boundary, and Draw X and Y limits\n");          fprintf(fp, "%%Draw boundary, and Draw X and Y limits\n");
         fprintf(fp, "1 setlinewidth\n");          fprintf(fp, "1 setlinewidth\n");
         fprintf(fp, "0 setgray\n");          fprintf(fp, "0 setgray\n");
         fprintf(fp, "%d %d %d %d rectangle\n\n",x1,y1,x2,y2);          fprintf(fp, "%d %d %d %d rectangle\n\n",x1,y1,x2,y2);
Line 218  void PostScriptOpenWindow(WindowType the
Line 218  void PostScriptOpenWindow(WindowType the
                 fprintf(fp, "/dtklog {xmax xmin div log cvi} def\n");                  fprintf(fp, "/dtklog {xmax xmin div log cvi} def\n");
                 fprintf(fp, "1 1 dtklog {doxlogtickmarks} for\n");                  fprintf(fp, "1 1 dtklog {doxlogtickmarks} for\n");
         }          }
         else          else
                 fprintf(fp, "doxlintickmarks\n");                  fprintf(fp, "doxlintickmarks\n");
   
         if (Is_Y_Log(theWindow)) {          if (Is_Y_Log(theWindow)) {
Line 233  void PostScriptOpenWindow(WindowType the
Line 233  void PostScriptOpenWindow(WindowType the
   
         fprintf(fp, "%%Determining scaling coefficients\n");          fprintf(fp, "%%Determining scaling coefficients\n");
         if (Is_Y_Log(theWindow)) {          if (Is_Y_Log(theWindow)) {
                 fprintf(fp, "/my {yps2 yps1 sub ymax ymin div log div} def\n");                  fprintf(fp, "/my {yps2 yps1 sub ymax ymin div log div} def\n");
                 fprintf(fp, "/by {yps1 ymax log mul yps2 ymin log mul sub ymax ymin div log div 0.5 add} def\n");                  fprintf(fp, "/by {yps1 ymax log mul yps2 ymin log mul sub ymax ymin div log div 0.5 add} def\n");
         }          }
         else {          else {
                 fprintf(fp, "/my {yps2 yps1 sub ymax ymin sub div yscale mul} def\n");                  fprintf(fp, "/my {yps2 yps1 sub ymax ymin sub div yscale mul} def\n");
                 fprintf(fp, "/by {yps1 ymax mul yps2 ymin mul sub ymax ymin sub div 0.5 add} def\n");                  fprintf(fp, "/by {yps1 ymax mul yps2 ymin mul sub ymax ymin sub div 0.5 add} def\n");
         }          }
         if (Is_X_Log(theWindow)) {          if (Is_X_Log(theWindow)) {
                 fprintf(fp, "/mx {xps2 xps1 sub xmax xmin div log div} def\n");                  fprintf(fp, "/mx {xps2 xps1 sub xmax xmin div log div} def\n");
                 fprintf(fp, "/bx {xps1 xmax log mul xps2 xmin log mul sub xmax xmin div log div 0.5 add} def\n\n");                  fprintf(fp, "/bx {xps1 xmax log mul xps2 xmin log mul sub xmax xmin div log div 0.5 add} def\n\n");
         }          }
         else {          else {
                 fprintf(fp, "/mx {xps2 xps1 sub xmax xmin sub div xscale mul} def\n");                  fprintf(fp, "/mx {xps2 xps1 sub xmax xmin sub div xscale mul} def\n");
                 fprintf(fp, "/bx {xps1 xmax mul xps2 xmin mul sub xmax xmin sub div 0.5 add} def\n\n");                  fprintf(fp, "/bx {xps1 xmax mul xps2 xmin mul sub xmax xmin sub div 0.5 add} def\n\n");
         }          }
   
         if (Is_X_Log(theWindow) && Is_Y_Log(theWindow)) {          if (Is_X_Log(theWindow) && Is_Y_Log(theWindow)) {
                 fprintf(fp, "/mv {exch xscale mul log mx mul bx add exch yscale mul log my mul by add moveto} def\n");                  fprintf(fp, "/mv {exch xscale mul log mx mul bx add exch yscale mul log my mul by add moveto} def\n");
                 fprintf(fp, "/ln {exch xscale mul log mx mul bx add exch yscale mul log my mul by add lineto} def\n\n");                  fprintf(fp, "/ln {exch xscale mul log mx mul bx add exch yscale mul log my mul by add lineto} def\n\n");
         }          }
         else if (Is_X_Log(theWindow) && !Is_Y_Log(theWindow)) {          else if (Is_X_Log(theWindow) && !Is_Y_Log(theWindow)) {
                 fprintf(fp, "/mv {exch xscale mul log mx mul bx add exch my mul by add moveto} def\n");                  fprintf(fp, "/mv {exch xscale mul log mx mul bx add exch my mul by add moveto} def\n");
                 fprintf(fp, "/ln {exch xscale mul log mx mul bx add exch my mul by add lineto} def\n\n");                  fprintf(fp, "/ln {exch xscale mul log mx mul bx add exch my mul by add lineto} def\n\n");
         }          }
         else if (!Is_X_Log(theWindow) && Is_Y_Log(theWindow)) {          else if (!Is_X_Log(theWindow) && Is_Y_Log(theWindow)) {
                 fprintf(fp, "/mv {exch mx mul bx add exch yscale mul log my mul by add moveto} def\n");                  fprintf(fp, "/mv {exch mx mul bx add exch yscale mul log my mul by add moveto} def\n");
                 fprintf(fp, "/ln {exch mx mul bx add exch yscale mul log my mul by add lineto} def\n\n");                  fprintf(fp, "/ln {exch mx mul bx add exch yscale mul log my mul by add lineto} def\n\n");
         }          }
         else {          else {
                 fprintf(fp, "/mv {exch mx mul bx add exch my mul by add moveto} def\n");                  fprintf(fp, "/mv {exch mx mul bx add exch my mul by add moveto} def\n");
                 fprintf(fp, "/ln {exch mx mul bx add exch my mul by add lineto} def\n\n");                  fprintf(fp, "/ln {exch mx mul bx add exch my mul by add lineto} def\n\n");
         }          }
   
         /***************************/          /***************************/
Line 286  void PostScriptOpenWindow(WindowType the
Line 286  void PostScriptOpenWindow(WindowType the
                 if (Is_X_Log(theWindow)) {                  if (Is_X_Log(theWindow)) {
                         for (i = 0; i < n; i++)                          for (i = 0; i < n; i++)
                                 StructPoints[i].x = mx * log10(max(label_Ptr->X_Scale *                                  StructPoints[i].x = mx * log10(max(label_Ptr->X_Scale *
                                                                                         structures->x[i],                                                          structures->x[i],
                                                                                         DBL_MIN)) + bx;                                                          DBL_MIN)) + bx;
                 }                  }
                 else {                  else {
                         for (i = 0; i < n; i++)                          for (i = 0; i < n; i++)
                                 StructPoints[i].x = mx * structures->x[i] + bx;                                  StructPoints[i].x = mx * structures->x[i] + bx;
                 }                  }
   
                 if (Is_Y_Log(theWindow)) {                  if (Is_Y_Log(theWindow)) {
                         for (i = 0; i < n; i++)                          for (i = 0; i < n; i++)
                                 StructPoints[i].y = my * log10(max(label_Ptr->Y_Scale *                                  StructPoints[i].y = my * log10(max(label_Ptr->Y_Scale *
                                                                                         structures->y[i],                                                          structures->y[i],
                                                                                         DBL_MIN)) + by;                                                          DBL_MIN)) + by;
                 }                  }
                 else {                  else {
                         for (i = 0; i < n; i++)                          for (i = 0; i < n; i++)
Line 368  void PostScriptOpenWindow(WindowType the
Line 368  void PostScriptOpenWindow(WindowType the
 } // }}}  } // }}}
   
 void PostScript_Vector_Window(WindowType theWindow, char *eps_file_name,  void PostScript_Vector_Window(WindowType theWindow, char *eps_file_name,
                                                 char *plot_title)                  char *plot_title)
 { // {{{  { // {{{
         DataType        data_Ptr;          DataType        data_Ptr;
         LabelType       label_Ptr;          LabelType       label_Ptr;
Line 440  void PostScript_Vector_Window(WindowType
Line 440  void PostScript_Vector_Window(WindowType
         /****************************/          /****************************/
         /* find longest vector in the system */          /* find longest vector in the system */
   
         maxvlen = Vlength(VectorZ(data_Ptr,mstart,nstart),          maxvlen = Vlength(VectorZ(data_Ptr,mstart,nstart),
                                                         VectorW(data_Ptr,mstart,nstart));                          VectorW(data_Ptr,mstart,nstart));
         for (i = mstart; i <= mend; i++)          for (i = mstart; i <= mend; i++)
                 for (j = nstart; j <= nend; j++)                  for (j = nstart; j <= nend; j++)
                         maxvlen = max(maxvlen, Vlength(VectorZ(data_Ptr,i,j),                          maxvlen = max(maxvlen, Vlength(VectorZ(data_Ptr,i,j),
                                                                                 VectorW(data_Ptr,i,j)));                                                  VectorW(data_Ptr,i,j)));
   
         mx = (x2 - x1) / (label_Ptr->X_Max - label_Ptr->X_Min + DBL_MIN) * label_Ptr->X_Scale;          mx = (x2 - x1) / (label_Ptr->X_Max - label_Ptr->X_Min + DBL_MIN) * label_Ptr->X_Scale;
         bx = (label_Ptr->X_Max * x1 - label_Ptr->X_Min * x2)          bx = (label_Ptr->X_Max * x1 - label_Ptr->X_Min * x2)
Line 503  void PostScript_Vector_Window(WindowType
Line 503  void PostScript_Vector_Window(WindowType
                 if (Is_X_Log(theWindow)) {                  if (Is_X_Log(theWindow)) {
                         for (i = 0; i < n; i++)                          for (i = 0; i < n; i++)
                                 StructPoints[i].x = mx * log10(max(label_Ptr->X_Scale *                                  StructPoints[i].x = mx * log10(max(label_Ptr->X_Scale *
                                                                                         structures->x[i],                                                          structures->x[i],
                                                                                         DBL_MIN)) + bx;                                                          DBL_MIN)) + bx;
                 }                  }
                 else {                  else {
                         for (i = 0; i < n; i++)                          for (i = 0; i < n; i++)
                                 StructPoints[i].x = mx * structures->x[i] + bx;                                  StructPoints[i].x = mx * structures->x[i] + bx;
                 }                  }
   
                 if (Is_Y_Log(theWindow)) {                  if (Is_Y_Log(theWindow)) {
                         for (i = 0; i < n; i++)                          for (i = 0; i < n; i++)
                                 StructPoints[i].y = my * log10(max(label_Ptr->Y_Scale *                                  StructPoints[i].y = my * log10(max(label_Ptr->Y_Scale *
                                                                                         structures->y[i],                                                          structures->y[i],
                                                                                         DBL_MIN)) + by;                                                          DBL_MIN)) + by;
                 }                  }
                 else {                  else {
                         for (i = 0; i < n; i++)                          for (i = 0; i < n; i++)
Line 533  void PostScript_Vector_Window(WindowType
Line 533  void PostScript_Vector_Window(WindowType
   
                 fprintf(fp, "1 setlinewidth\n");                  fprintf(fp, "1 setlinewidth\n");
                 if (structures->fillFlag == FILLED) {                  if (structures->fillFlag == FILLED) {
                         fprintf(fp, "%f %f %f setrgbcolor\n",                          fprintf(fp, "%f %f %f setrgbcolor\n",
                                                                         RedColor[structures->fillColor],                                          RedColor[structures->fillColor],
                                                                         GreenColor[structures->fillColor],                                          GreenColor[structures->fillColor],
                                                                         BlueColor[structures->fillColor]);                                          BlueColor[structures->fillColor]);
                         fprintf(fp, "fill\n");                          fprintf(fp, "fill\n");
                 }                  }
   
                 XLookupColor(theDisplay, theColormap, theColorNames[structures->lineColor],                  XLookupColor(theDisplay, theColormap, theColorNames[structures->lineColor],
                                                                 &theRGBColor, &theHardwareColor);                                  &theRGBColor, &theHardwareColor);
                 fprintf(fp, "%f %f %f setrgbcolor\n", RedColor[structures->lineColor],                  fprintf(fp, "%f %f %f setrgbcolor\n", RedColor[structures->lineColor],
                                                                 GreenColor[structures->lineColor],                                  GreenColor[structures->lineColor],
                                                                 BlueColor[structures->lineColor]);                                  BlueColor[structures->lineColor]);
                 fprintf(fp, "1 setlinewidth\nstroke\n\n");                  fprintf(fp, "1 setlinewidth\nstroke\n\n");
   
                 free(StructPoints);                  free(StructPoints);
Line 560  void PostScript_Vector_Window(WindowType
Line 560  void PostScript_Vector_Window(WindowType
         for (i = mstart; i <= mend; i++)          for (i = mstart; i <= mend; i++)
                 for (j = nstart; j <= nend; j++) {                  for (j = nstart; j <= nend; j++) {
                         fprintf(fp, "%1.0f %1.0f %1.0f %1.0f arw\n", Point[i][j].x,Point[i][j].y,                          fprintf(fp, "%1.0f %1.0f %1.0f %1.0f arw\n", Point[i][j].x,Point[i][j].y,
                                                                         Vector[i][j].x, Vector[i][j].y);                                          Vector[i][j].x, Vector[i][j].y);
                 }                  }
         fprintf(fp, "stroke\n\n");          fprintf(fp, "stroke\n\n");
   
Line 575  void PostScript_Vector_Window(WindowType
Line 575  void PostScript_Vector_Window(WindowType
   
         fprintf(fp, "gsave 0 setgray .8 setlinewidth\n");          fprintf(fp, "gsave 0 setgray .8 setlinewidth\n");
         if ((label_Ptr->Y_Min < 0.0 && 0.0 < label_Ptr->Y_Max) ||          if ((label_Ptr->Y_Min < 0.0 && 0.0 < label_Ptr->Y_Max) ||
                                                         (label_Ptr->Y_Max < 0.0 && 0.0 < label_Ptr->Y_Min)) {                          (label_Ptr->Y_Max < 0.0 && 0.0 < label_Ptr->Y_Min)) {
                 dtick = (y2 - y1) / (label_Ptr->Y_Max - label_Ptr->Y_Min);                  dtick = (y2 - y1) / (label_Ptr->Y_Max - label_Ptr->Y_Min);
                 fprintf(fp, "%d %g moveto\n", x1, y2 - dtick * (label_Ptr->Y_Max));                  fprintf(fp, "%d %g moveto\n", x1, y2 - dtick * (label_Ptr->Y_Max));
                 fprintf(fp, "%d %g lineto\n", x1 + 4, y2 - dtick * (label_Ptr->Y_Max));                  fprintf(fp, "%d %g lineto\n", x1 + 4, y2 - dtick * (label_Ptr->Y_Max));
Line 584  void PostScript_Vector_Window(WindowType
Line 584  void PostScript_Vector_Window(WindowType
                 fprintf(fp, "%d %g lineto\n", x2, y2 - dtick * (label_Ptr->Y_Max));                  fprintf(fp, "%d %g lineto\n", x2, y2 - dtick * (label_Ptr->Y_Max));
         }          }
         if ((label_Ptr->X_Min < 0.0 && 0.0 < label_Ptr->X_Max) ||          if ((label_Ptr->X_Min < 0.0 && 0.0 < label_Ptr->X_Max) ||
                                                         (label_Ptr->X_Max < 0.0 && 0.0 < label_Ptr->X_Min)) {                          (label_Ptr->X_Max < 0.0 && 0.0 < label_Ptr->X_Min)) {
                 dtick = (x2 - x1) / (label_Ptr->X_Max - label_Ptr->X_Min);                  dtick = (x2 - x1) / (label_Ptr->X_Max - label_Ptr->X_Min);
                 fprintf(fp, "%g %d moveto\n", x2 - dtick * (label_Ptr->X_Max), y2);                  fprintf(fp, "%g %d moveto\n", x2 - dtick * (label_Ptr->X_Max), y2);
                 fprintf(fp, "%g %d lineto\n", x2 - dtick * (label_Ptr->X_Max), y2 - 4);                  fprintf(fp, "%g %d lineto\n", x2 - dtick * (label_Ptr->X_Max), y2 - 4);
Line 622  void PSHeader(char *filename)
Line 622  void PSHeader(char *filename)
         fprintf(fp, "%%!PS-Adobe-3.0 EPSF-3.0\n");          fprintf(fp, "%%!PS-Adobe-3.0 EPSF-3.0\n");
         fprintf(fp, "%%%%BoundingBox: 72 72 540 730\n");          fprintf(fp, "%%%%BoundingBox: 72 72 540 730\n");
         fprintf(fp, "%%%%Creator: XGrafix %s Copyright 1991-93 The Regents of the University of California\n",          fprintf(fp, "%%%%Creator: XGrafix %s Copyright 1991-93 The Regents of the University of California\n",
                                                         xgversion);                          xgversion);
         fprintf(fp, "%%%%Title: %s\n", filename);          fprintf(fp, "%%%%Title: %s\n", filename);
         fprintf(fp, "%%%%Pages: 1 1\n");          fprintf(fp, "%%%%Pages: 1 1\n");
         fprintf(fp, "%%%%EndComments\n");          fprintf(fp, "%%%%EndComments\n");
Line 677  void PSHeader(char *filename)
Line 677  void PSHeader(char *filename)
         fprintf(fp, "/sp5 {(#) prtstrfrommidlow} def\n");          fprintf(fp, "/sp5 {(#) prtstrfrommidlow} def\n");
         fprintf(fp, "/sp6 {(@) prtstrfrommidlow} def\n\n");          fprintf(fp, "/sp6 {(@) prtstrfrommidlow} def\n\n");
   
         fprintf(fp, "%%Dash line type definitions\n");          fprintf(fp, "%%Dash line type definitions\n");
         fprintf(fp, "/Dash0 {[] 0 setdash} def\n");          fprintf(fp, "/Dash0 {[] 0 setdash} def\n");
         fprintf(fp, "/Dash1 {[0 2] 2 setdash} def\n");          fprintf(fp, "/Dash1 {[0 2] 2 setdash} def\n");
         fprintf(fp, "/Dash2 {[4 1 3] 5 setdash} def\n");          fprintf(fp, "/Dash2 {[4 1 3] 5 setdash} def\n");
Line 713  void PSHeader(char *filename)
Line 713  void PSHeader(char *filename)
         fprintf(fp, "} {x0 y0 moveto sp0} ifelse grestore\n");          fprintf(fp, "} {x0 y0 moveto sp0} ifelse grestore\n");
         fprintf(fp, "} def\n\n");          fprintf(fp, "} def\n\n");
   
         fprintf(fp, "%%Scratch string space\n");          fprintf(fp, "%%Scratch string space\n");
         fprintf(fp, "/str 20 string def\n\n");          fprintf(fp, "/str 20 string def\n\n");
   
         fprintf(fp, "%%Define macro for linear tick marks alog x\n");          fprintf(fp, "%%Define macro for linear tick marks alog x\n");
         fprintf(fp, "/doxlintickmarks {\n");          fprintf(fp, "/doxlintickmarks {\n");
Line 729  void PSHeader(char *filename)
Line 729  void PSHeader(char *filename)
         fprintf(fp, " dup xps2 xps1 sub mul dtklog div xps1 add yps1 moveto\n");          fprintf(fp, " dup xps2 xps1 sub mul dtklog div xps1 add yps1 moveto\n");
         fprintf(fp, " dup xps2 xps1 sub mul dtklog div xps1 add yps1 4 add lineto\n");          fprintf(fp, " dup xps2 xps1 sub mul dtklog div xps1 add yps1 4 add lineto\n");
         fprintf(fp, " dup xps2 xps1 sub mul dtklog div xps1 add yps2 4 sub moveto\n");          fprintf(fp, " dup xps2 xps1 sub mul dtklog div xps1 add yps2 4 sub moveto\n");
         fprintf(fp, " xps2 xps1 sub mul dtklog div xps1 add yps2 lineto\n");          fprintf(fp, " xps2 xps1 sub mul dtklog div xps1 add yps2 lineto\n");
         fprintf(fp, " stroke} def\n\n");          fprintf(fp, " stroke} def\n\n");
   
         fprintf(fp, "%%Define macro for linear tick marks alog y\n");          fprintf(fp, "%%Define macro for linear tick marks alog y\n");
Line 745  void PSHeader(char *filename)
Line 745  void PSHeader(char *filename)
         fprintf(fp, " dup yps2 yps1 sub mul dtklog div yps1 add xps1 exch moveto\n");          fprintf(fp, " dup yps2 yps1 sub mul dtklog div yps1 add xps1 exch moveto\n");
         fprintf(fp, " dup yps2 yps1 sub mul dtklog div yps1 add xps1 4 add exch lineto\n");          fprintf(fp, " dup yps2 yps1 sub mul dtklog div yps1 add xps1 4 add exch lineto\n");
         fprintf(fp, " dup yps2 yps1 sub mul dtklog div yps1 add xps2 4 sub exch moveto\n");          fprintf(fp, " dup yps2 yps1 sub mul dtklog div yps1 add xps2 4 sub exch moveto\n");
         fprintf(fp, " yps2 yps1 sub mul dtklog div yps1 add xps2 exch lineto\n");          fprintf(fp, " yps2 yps1 sub mul dtklog div yps1 add xps2 exch lineto\n");
         fprintf(fp, " stroke} def\n\n");          fprintf(fp, " stroke} def\n\n");
   
         fprintf(fp, "%%Print the XGrafix logo\n");          fprintf(fp, "%%Print the XGrafix logo\n");
Line 759  void PSHeader(char *filename)
Line 759  void PSHeader(char *filename)
 } // }}}  } // }}}
   
 void PostScript_ThreeD_Window(WindowType theWindow, char *eps_file_name,  void PostScript_ThreeD_Window(WindowType theWindow, char *eps_file_name,
                                                 char *plot_title)                  char *plot_title)
 { // {{{  { // {{{
         DataType        data_Ptr;          DataType        data_Ptr;
         LabelType       label_Ptr;          LabelType       label_Ptr;
Line 1108  void PostScript_ThreeD_Window(WindowType
Line 1108  void PostScript_ThreeD_Window(WindowType
         /**************************************************/          /**************************************************/
   
         if (label_Ptr->Z_Max == label_Ptr->Z_Min || label_Ptr->Y_Max == label_Ptr->Y_Min ||          if (label_Ptr->Z_Max == label_Ptr->Z_Min || label_Ptr->Y_Max == label_Ptr->Y_Min ||
                                                         label_Ptr->X_Max == label_Ptr->X_Min)                          label_Ptr->X_Max == label_Ptr->X_Min)
                 return;                  return;
   
         /****************************************************/          /****************************************************/
Line 1243  void PostScript_ThreeD_Window(WindowType
Line 1243  void PostScript_ThreeD_Window(WindowType
   
         if (Is_X_Log(theWindow)) {          if (Is_X_Log(theWindow)) {
                 a1 = 1.0 / log10(max(label_Ptr->X_Max/(label_Ptr->X_Min+DBL_MIN),DBL_MIN));                  a1 = 1.0 / log10(max(label_Ptr->X_Max/(label_Ptr->X_Min+DBL_MIN),DBL_MIN));
                 b1 = log10(max(label_Ptr->X_Min / (label_Ptr->X_Scale+DBL_MIN),DBL_MIN)) /                  b1 = log10(max(label_Ptr->X_Min / (label_Ptr->X_Scale+DBL_MIN),DBL_MIN)) /
                         log10(max(label_Ptr->X_Max / (label_Ptr->X_Min+DBL_MIN),DBL_MIN));                          log10(max(label_Ptr->X_Max / (label_Ptr->X_Min+DBL_MIN),DBL_MIN));
         }          }
         else {          else {
Line 1252  void PostScript_ThreeD_Window(WindowType
Line 1252  void PostScript_ThreeD_Window(WindowType
         }          }
         if (Is_Y_Log(theWindow)) {          if (Is_Y_Log(theWindow)) {
                 a2 = 1.0 / log10(max(label_Ptr->Y_Max/(label_Ptr->Y_Min+DBL_MIN),DBL_MIN));                  a2 = 1.0 / log10(max(label_Ptr->Y_Max/(label_Ptr->Y_Min+DBL_MIN),DBL_MIN));
                 b2 = log10(max(label_Ptr->Y_Min / (label_Ptr->Y_Scale+DBL_MIN),DBL_MIN)) /                  b2 = log10(max(label_Ptr->Y_Min / (label_Ptr->Y_Scale+DBL_MIN),DBL_MIN)) /
                         log10(max(label_Ptr->Y_Max / (label_Ptr->Y_Min+DBL_MIN),DBL_MIN));                          log10(max(label_Ptr->Y_Max / (label_Ptr->Y_Min+DBL_MIN),DBL_MIN));
         }          }
         else {          else {
Line 1261  void PostScript_ThreeD_Window(WindowType
Line 1261  void PostScript_ThreeD_Window(WindowType
         }          }
         if (Is_Z_Log(theWindow)) {          if (Is_Z_Log(theWindow)) {
                 a3 = 1.0 / log10(max(label_Ptr->Z_Max/(label_Ptr->Z_Min+DBL_MIN),DBL_MIN));                  a3 = 1.0 / log10(max(label_Ptr->Z_Max/(label_Ptr->Z_Min+DBL_MIN),DBL_MIN));
                 b3 = log10(max(label_Ptr->Z_Min / (label_Ptr->Z_Scale+DBL_MIN),DBL_MIN)) /                  b3 = log10(max(label_Ptr->Z_Min / (label_Ptr->Z_Scale+DBL_MIN),DBL_MIN)) /
                         log10(max(label_Ptr->Z_Max / (label_Ptr->Z_Min+DBL_MIN),DBL_MIN));                          log10(max(label_Ptr->Z_Max / (label_Ptr->Z_Min+DBL_MIN),DBL_MIN));
         }          }
         else {          else {
Line 1289  void PostScript_ThreeD_Window(WindowType
Line 1289  void PostScript_ThreeD_Window(WindowType
                                 ztemp = a3 * log10(max(ScatterZ(data_Ptr,i),DBL_MIN)) - b3;                                  ztemp = a3 * log10(max(ScatterZ(data_Ptr,i),DBL_MIN)) - b3;
                         else                          else
                                 ztemp = a3 * ScatterZ(data_Ptr,i) - b3;                                  ztemp = a3 * ScatterZ(data_Ptr,i) - b3;
                         if (0.0 < xtemp && xtemp < 1.0 && 0.0 < ytemp && ytemp < 1.0 &&                          if (0.0 < xtemp && xtemp < 1.0 && 0.0 < ytemp && ytemp < 1.0 &&
                                                                         0.0 < ztemp && ztemp < 1.0)                                          0.0 < ztemp && ztemp < 1.0)
                                 fprintf(fp, "%g %g moveto sp0\n", c1 * (u1 * xtemp + u2 * ytemp +                                  fprintf(fp, "%g %g moveto sp0\n", c1 * (u1 * xtemp + u2 * ytemp +
                                                                                         u3 * ztemp) + d1,                                                          u3 * ztemp) + d1,
                                                                                 c2 * (v1 * xtemp + v2 * ytemp + v3 * ztemp) + d2);                                                  c2 * (v1 * xtemp + v2 * ytemp + v3 * ztemp) + d2);
                 }                  }
                 fprintf(fp, "stroke\n\n");                  fprintf(fp, "stroke\n\n");
         }          }
Line 1302  void PostScript_ThreeD_Window(WindowType
Line 1302  void PostScript_ThreeD_Window(WindowType
                 for (i = 0; i < m; i++) {                  for (i = 0; i < m; i++) {
                         theMeshPoint[i] = (MeshType *) malloc(n * sizeof(MeshType));                          theMeshPoint[i] = (MeshType *) malloc(n * sizeof(MeshType));
   
                         if (Is_Irr_Surf(data_Ptr)) {                          if (Is_Irr_Surf(data_Ptr)) {
                                 for (j = 0; j < n; j++) {                                  for (j = 0; j < n; j++) {
                                         if (Is_X_Log(theWindow))                                          if (Is_X_Log(theWindow))
                                                 xtemp = a1 * log10(fabs(IrregularX(data_Ptr,i,j))+DBL_MIN) - b1;                                                  xtemp = a1 * log10(fabs(IrregularX(data_Ptr,i,j))+DBL_MIN) - b1;
Line 1388  void PostScript_ThreeD_Window(WindowType
Line 1388  void PostScript_ThreeD_Window(WindowType
                 }                  }
   
                 if ((!Is_Shading_On(theWindow) && Is_Grid_On(theWindow)) ||                  if ((!Is_Shading_On(theWindow) && Is_Grid_On(theWindow)) ||
                                                                 (Is_Shading_On(theWindow) && Is_ColorCode_On(theWindow)) ||                                  (Is_Shading_On(theWindow) && Is_ColorCode_On(theWindow)) ||
                                                                 (Is_Shading_On(theWindow) && Is_Grid_On(theWindow)                                  (Is_Shading_On(theWindow) && Is_Grid_On(theWindow)
                                                                  && !Is_ColorCode_On(theWindow))) {                                   && !Is_ColorCode_On(theWindow))) {
                         fprintf(fp, "\n.4 setlinewidth\n");                          fprintf(fp, "\n.4 setlinewidth\n");
                         for (i = xstart; i != xend; i += xstep)                          for (i = xstart; i != xend; i += xstep)
                                 for (j = ystart; j != yend; j += ystep) {                                  for (j = ystart; j != yend; j += ystep) {
                                         if (Is_ColorCode_On(theWindow)) {                                          if (Is_ColorCode_On(theWindow)) {
                                                 if (Is_Z_Log(theWindow))                                                  if (Is_Z_Log(theWindow))
                                                         colornumber = MAXTHREEDCOLORS *                                                          colornumber = MAXTHREEDCOLORS *
                                                                 (.25 * a3 * log10(fabs(SurfaceZ(data_Ptr,i,j) *                                                                  (.25 * a3 * log10(fabs(SurfaceZ(data_Ptr,i,j) *
                                                                                                            SurfaceZ(data_Ptr,i + 1,j) *                                                                                                             SurfaceZ(data_Ptr,i + 1,j) *
                                                                                                            SurfaceZ(data_Ptr,i + 1,j + 1) *                                                                                                             SurfaceZ(data_Ptr,i + 1,j + 1) *
                                                                                                            SurfaceZ(data_Ptr,i,j + 1)) +                                                                                                             SurfaceZ(data_Ptr,i,j + 1)) +
                                                                                                   DBL_MIN) - b3);                                                                                                    DBL_MIN) - b3);
                                                 else                                                  else
                                                         colornumber = MAXTHREEDCOLORS *                                                          colornumber = MAXTHREEDCOLORS *
                                                                 (.25 * a3 * (SurfaceZ(data_Ptr,i,j) + SurfaceZ(data_Ptr,i+1,j)+                                                                  (.25 * a3 * (SurfaceZ(data_Ptr,i,j) + SurfaceZ(data_Ptr,i+1,j)+
                                                                                          SurfaceZ(data_Ptr,i + 1,j + 1) +                                                                                           SurfaceZ(data_Ptr,i + 1,j + 1) +
                                                                                          SurfaceZ(data_Ptr,i,j + 1)) - b3);                                                                                           SurfaceZ(data_Ptr,i,j + 1)) - b3);
   
                                                 if (colornumber >= MAXTHREEDCOLORS)                                                  if (colornumber >= MAXTHREEDCOLORS)
Line 1415  void PostScript_ThreeD_Window(WindowType
Line 1415  void PostScript_ThreeD_Window(WindowType
                                                 fprintf(fp, "%s setrgbcolor\n", ThreeDPSColor[colornumber]);                                                  fprintf(fp, "%s setrgbcolor\n", ThreeDPSColor[colornumber]);
                                         }                                          }
                                         fprintf(fp, "%d %d %d %d %d %d %d %d",                                          fprintf(fp, "%d %d %d %d %d %d %d %d",
                                                                                         (int) (c1 * theMeshPoint[i][j].x + d1), (int) (c2 * theMeshPoint[i][j].y + d2),                                                          (int) (c1 * theMeshPoint[i][j].x + d1), (int) (c2 * theMeshPoint[i][j].y + d2),
                                                                                         (int) (c1 * theMeshPoint[i + 1][j].x + d1), (int) (c2 * theMeshPoint[i + 1][j].y + d2),                                                          (int) (c1 * theMeshPoint[i + 1][j].x + d1), (int) (c2 * theMeshPoint[i + 1][j].y + d2),
                                                                                         (int) (c1 * theMeshPoint[i + 1][j + 1].x + d1), (int) (c2 * theMeshPoint[i + 1][j + 1].y + d2),                                                          (int) (c1 * theMeshPoint[i + 1][j + 1].x + d1), (int) (c2 * theMeshPoint[i + 1][j + 1].y + d2),
                                                                                         (int) (c1 * theMeshPoint[i][j + 1].x + d1), (int) (c2 * theMeshPoint[i][j + 1].y + d2));                                                          (int) (c1 * theMeshPoint[i][j + 1].x + d1), (int) (c2 * theMeshPoint[i][j + 1].y + d2));
   
                                         if (Is_Grid_On(theWindow) && !Is_ColorCode_On(theWindow))                                          if (Is_Grid_On(theWindow) && !Is_ColorCode_On(theWindow))
                                                 fprintf(fp, " bbwfpoly\n");                                                  fprintf(fp, " bbwfpoly\n");
                                         else if (!Is_Shading_On(theWindow) && Is_ColorCode_On(theWindow)                                          else if (!Is_Shading_On(theWindow) && Is_ColorCode_On(theWindow)
                                                                                         && Is_Grid_On(theWindow))                                                          && Is_Grid_On(theWindow))
                                                 fprintf(fp, " cbwfpoly\n");                                                  fprintf(fp, " cbwfpoly\n");
                                         else if (Is_Shading_On(theWindow) && Is_ColorCode_On(theWindow)                                          else if (Is_Shading_On(theWindow) && Is_ColorCode_On(theWindow)
                                                                                         && !Is_Grid_On(theWindow))                                                          && !Is_Grid_On(theWindow))
                                                 fprintf(fp, " nbcfpoly\n");                                                  fprintf(fp, " nbcfpoly\n");
                                         else if (Is_Shading_On(theWindow) && Is_ColorCode_On(theWindow)                                          else if (Is_Shading_On(theWindow) && Is_ColorCode_On(theWindow)
                                                                                         && Is_Grid_On(theWindow))                                                          && Is_Grid_On(theWindow))
                                                 fprintf(fp, " bbcfpoly\n");                                                  fprintf(fp, " bbcfpoly\n");
                                 }                                  }
                 }                  }
Line 1523  void Ascii_TwoD_Window(WindowType theWin
Line 1523  void Ascii_TwoD_Window(WindowType theWin
   
                 for (i=0;i<n;i++)                  for (i=0;i<n;i++)
                         fprintf(fp,"%.6G\t\t%.6G\n", xscale*(CurveX(theData,i)),                          fprintf(fp,"%.6G\t\t%.6G\n", xscale*(CurveX(theData,i)),
                                                                         yscale*(CurveY(theData,i)));                                          yscale*(CurveY(theData,i)));
   
                 theData = theData->next;                  theData = theData->next;
         }          }
Line 1562  void Ascii_ThreeD_Window(WindowType theW
Line 1562  void Ascii_ThreeD_Window(WindowType theW
         if (Is_Scatter(theData)) {          if (Is_Scatter(theData)) {
                 for (i=0;i<n;i++) {                  for (i=0;i<n;i++) {
                         fprintf(fp,"%.6G\t\t%.6G\t\t%.6G\n", xscale*(ScatterX(theData,i)),                          fprintf(fp,"%.6G\t\t%.6G\t\t%.6G\n", xscale*(ScatterX(theData,i)),
                                                                         yscale*(ScatterY(theData,i)), zscale*(ScatterZ(theData,i)));                                          yscale*(ScatterY(theData,i)), zscale*(ScatterZ(theData,i)));
                 }                  }
         }          }
         else {          else {
Line 1572  void Ascii_ThreeD_Window(WindowType theW
Line 1572  void Ascii_ThreeD_Window(WindowType theW
                         for (i=0;i<m;i++) {                          for (i=0;i<m;i++) {
                                 for (j=0;j<n;j++) {                                  for (j=0;j<n;j++) {
                                         fprintf(fp,"%.6G\t\t%.6G\t\t%.6G\n", xscale*(IrregularX(theData,i,j)),                                          fprintf(fp,"%.6G\t\t%.6G\t\t%.6G\n", xscale*(IrregularX(theData,i,j)),
                                                                                         yscale*(IrregularY(theData,i,j)), zscale*(IrregularZ(theData,i,j)));                                                          yscale*(IrregularY(theData,i,j)), zscale*(IrregularZ(theData,i,j)));
                                 }                                  }
                         }                          }
                 }                  }
Line 1580  void Ascii_ThreeD_Window(WindowType theW
Line 1580  void Ascii_ThreeD_Window(WindowType theW
                         for (i=0;i<m;i++) {                          for (i=0;i<m;i++) {
                                 for (j=0;j<n;j++) {                                  for (j=0;j<n;j++) {
                                         fprintf(fp,"%.6G\t\t%.6G\t\t%.6G\n", xscale*(SurfaceX(theData,i)),                                          fprintf(fp,"%.6G\t\t%.6G\t\t%.6G\n", xscale*(SurfaceX(theData,i)),
                                                                                         yscale*(SurfaceY(theData,j)), zscale*(SurfaceZ(theData,i,j)));                                                          yscale*(SurfaceY(theData,j)), zscale*(SurfaceZ(theData,i,j)));
                                 }                                  }
                         }                          }
                 }                  }
Line 1615  void Ascii_Vector_Window(WindowType theW
Line 1615  void Ascii_Vector_Window(WindowType theW
         for (i=0;i<m;i++) {          for (i=0;i<m;i++) {
                 for (j=0;j<n;j++) {                  for (j=0;j<n;j++) {
                         fprintf(fp,"%.6G\t%.6G\t%.6G\t%.6G\n",VectorX(theData,i),                          fprintf(fp,"%.6G\t%.6G\t%.6G\t%.6G\n",VectorX(theData,i),
                                                                         VectorY(theData,j),VectorW(theData,i,j),                                          VectorY(theData,j),VectorW(theData,i,j),
                                                                         VectorZ(theData,i,j));                                          VectorZ(theData,i,j));
                 }                  }
         }          }
   
Line 1624  void Ascii_Vector_Window(WindowType theW
Line 1624  void Ascii_Vector_Window(WindowType theW
 } // }}}  } // }}}
   
 /*  /*
 extern void BXG_Write_2D(DataType theData,LabelType theLabel,StructType *structs,char *filename, char *type, double *theTimeStep);     extern void BXG_Write_2D(DataType theData,LabelType theLabel,StructType *structs,char *filename, char *type, double *theTimeStep);
 extern void BXG_Write_3D(DataType theData, LabelType theLabel,char *filename, char *type, double *theTimeStep);     extern void BXG_Write_3D(DataType theData, LabelType theLabel,char *filename, char *type, double *theTimeStep);
 extern void  BXG_Write_Vector(DataType theData,LabelType theLabel, StructType *structs,char *filename,char *type, double *theTimeStep);     extern void  BXG_Write_Vector(DataType theData,LabelType theLabel, StructType *structs,char *filename,char *type, double *theTimeStep);
 */     */
   
 void Bin_TwoD_Window(WindowType theWindow, char *filename, char *type)  void Bin_TwoD_Window(WindowType theWindow, char *filename, char *type)
 { // {{{  { // {{{
         //BXG_Write_2D(theWindow->data,theWindow->label, filename, type, theTimeStep);          //BXG_Write_2D(theWindow->data,theWindow->label, filename, type, theTimeStep);
         BXG_Write_2D(theWindow->data,          BXG_Write_2D(theWindow->data,
                                                         theWindow->label,                          theWindow->label,
                                                         theWindow->structures,                          theWindow->structures,
                                                         filename,                          filename,
                                                         type,                          type,
                                                         theTimeStep);                          theTimeStep);
 } // }}}  } // }}}
   
 void Bin_ThreeD_Window(WindowType theWindow, char *filename, char *type)  void Bin_ThreeD_Window(WindowType theWindow, char *filename, char *type)
 { // {{{  { // {{{
         BXG_Write_3D(theWindow->data,          BXG_Write_3D(theWindow->data,
                                                         theWindow->label,                          theWindow->label,
                                                 //      theWindow->structures,                          //      theWindow->structures,
                                                         filename,                          filename,
                                                         type,                          type,
                                                         theTimeStep);                          theTimeStep);
 } // }}}  } // }}}
   
 void Bin_Vector_Window(WindowType theWindow, char *filename, char *type)  void Bin_Vector_Window(WindowType theWindow, char *filename, char *type)
 { // {{{  { // {{{
         BXG_Write_Vector(theWindow->data,          BXG_Write_Vector(theWindow->data,
                                                         theWindow->label,                          theWindow->label,
                                                         theWindow->structures,                          theWindow->structures,
                                                         filename,                          filename,
                                                         type,                          type,
                                                         theTimeStep);                          theTimeStep);
 } // }}}  } // }}}
   
 // Modeline for ViM {{{1  // Modeline for ViM {{{1

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top