home *** CD-ROM | disk | FTP | other *** search
- /* Prints out text along a sloping axis joining world coordinates */
- /* (wx1,wy1) to (wx2,wy2). Parameters are as for plmtext */
-
- #include "plplot.h"
- #include <math.h>
-
- void plxytx(wx1,wy1,wx2,wy2,disp,pos,just,text)
- PLFLT wx1,wy1,wx2,wy2,disp,pos,just;
- char *text;
- {
- PLINT refx, refy;
- PLFLT shift, cc, ss, def, ht;
- PLFLT xform[4], diag;
- PLFLT xscl, xoff, yscl, yoff, wx, wy;
-
- gchr(&def,&ht);
- gwm(&xscl,&xoff,&yscl,&yoff);
- cc = xscl * (wx2-wx1);
- ss = yscl * (wy2-wy1);
- diag = sqrt(cc*cc + ss*ss);
- cc = cc/diag;
- ss = ss/diag;
-
- xform[0] = cc;
- xform[1] = 0.0;
- xform[2] = ss;
- xform[3] = 1.0;
-
- shift = 0.0;
- if (just != 0.0) shift = plstrl(text) * just;
- wx = wx1 + pos * (wx2 - wx1);
- wy = wy1 + pos * (wy2 - wy1);
-
- refx = mmpcx(wcmmx(wx) - shift * cc);
- refy = mmpcy(wcmmy(wy) - shift * ss - disp * ht);
- plstr(0,xform,refx,refy,text);
- }
-