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)
- float dx,dy,wx,wy1,wy2,disp,pos,just;
- char *opt, *text;
- {
- int refx, refy;
- int vert;
- float shift, cc, ss, def, ht;
- float xform[4], diag;
- float 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 (strpos(opt,'V') != -1 || strpos(opt,'v') != -1) {
- vert = 0;
- refx = mmpcx(wcmmx(wx) - (disp * ht + shift) * cc);
- refy = mmpcy(wcmmy(wy) - (disp * ht + shift) * ss);
- }
- else if (strpos(opt,'H') != -1 || strpos(opt,'h') != -1) {
- vert = 1;
- refy = wcpcy(wy) - yscl*(disp*ht*ss+shift);
- refx = mmpcx(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);
- }
-