home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 344b.lha / plplot_v2.6 / src / plztx.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-01-27  |  1.4 KB  |  54 lines

  1. /* Prints out text along a vertical axis for a 3d plot joining         */
  2. /*  world coordinates (wx,wy1) to (wx,wy2).                            */
  3.  
  4. #include "plplot.h"
  5. #include <math.h>
  6.  
  7. void plztx(opt,dx,dy,wx,wy1,wy2,disp,pos,just,text)
  8. PLFLT dx,dy,wx,wy1,wy2,disp,pos,just;
  9. char *opt, *text;
  10. {
  11.       PLINT refx, refy;
  12.       PLINT vert;
  13.       PLFLT shift, cc, ss, def, ht;
  14.       PLFLT xform[4], diag;
  15.       PLFLT xscl, xoff, yscl, yoff, wy;
  16.  
  17.       gchr(&def,&ht);
  18.       gwm(&xscl,&xoff,&yscl,&yoff);
  19.       cc = xscl * dx;
  20.       ss = yscl * dy;
  21.       diag = sqrt(cc*cc + ss*ss);
  22.       cc = cc/diag;
  23.       ss = ss/diag;
  24.       gmp(&xscl,&xoff,&yscl,&yoff);
  25.  
  26.       shift = 0.0;
  27.       if (just != 0.0) shift = plstrl(text) * just;
  28.       wy = wy1 + pos * (wy2 - wy1);
  29.  
  30.       if (stsearch(opt,'v')) {
  31.         vert = 0;
  32.         refx = mmpcx((PLFLT)(wcmmx(wx) - (disp * ht + shift) * cc));
  33.         refy = mmpcy((PLFLT)(wcmmy(wy) - (disp * ht + shift) * ss));
  34.       }
  35.       else if (stsearch(opt,'h')) {
  36.         vert = 1;
  37.         refy = wcpcy(wy) - yscl*(disp*ht*ss+shift);
  38.         refx = mmpcx((PLFLT)(wcmmx(wx) - disp*ht*cc));
  39.       }
  40.       if (vert) {
  41.         xform[0] = 0.0;
  42.         xform[1] = -cc;
  43.         xform[2] = 1.0;
  44.         xform[3] = -ss;
  45.       }
  46.       else {
  47.         xform[0] = cc;
  48.         xform[1] = 0.0;
  49.         xform[2] = ss;
  50.         xform[3] = 1.0;
  51.       }
  52.       plstr(0,xform,refx,refy,text);
  53. }
  54.