home *** CD-ROM | disk | FTP | other *** search
- /* Prints out text along a vertical axis for a 3d plot joining */
- /* world coordinates (wx,wy1) to (wx,wy2). */
-
- #include "plplot.h"
- #include <math.h>
-
- void plztx(opt,dx,dy,wx,wy1,wy2,disp,pos,just,text)
- PLFLT dx,dy,wx,wy1,wy2,disp,pos,just;
- char *opt, *text;
- {
- PLINT refx, refy;
- PLINT vert;
- PLFLT shift, cc, ss, def, ht;
- PLFLT xform[4], diag;
- PLFLT xscl, xoff, yscl, yoff, wy;
-
- gchr(&def,&ht);
- gwm(&xscl,&xoff,&yscl,&yoff);
- cc = xscl * dx;
- ss = yscl * dy;
- diag = sqrt(cc*cc + ss*ss);
- cc = cc/diag;
- ss = ss/diag;
- gmp(&xscl,&xoff,&yscl,&yoff);
-
- shift = 0.0;
- if (just != 0.0) shift = plstrl(text) * just;
- wy = wy1 + pos * (wy2 - wy1);
-
- if (stsearch(opt,'v')) {
- vert = 0;
- refx = mmpcx((PLFLT)(wcmmx(wx) - (disp * ht + shift) * cc));
- refy = mmpcy((PLFLT)(wcmmy(wy) - (disp * ht + shift) * ss));
- }
- else if (stsearch(opt,'h')) {
- vert = 1;
- refy = wcpcy(wy) - yscl*(disp*ht*ss+shift);
- refx = mmpcx((PLFLT)(wcmmx(wx) - disp*ht*cc));
- }
- if (vert) {
- xform[0] = 0.0;
- xform[1] = -cc;
- xform[2] = 1.0;
- xform[3] = -ss;
- }
- else {
- xform[0] = cc;
- xform[1] = 0.0;
- xform[2] = ss;
- xform[3] = 1.0;
- }
- plstr(0,xform,refx,refy,text);
- }
-