home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d2xx
/
d222
/
plplot.lha
/
Plplot
/
src
/
source.zoo
/
plxytx.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-15
|
984b
|
38 lines
/* 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)
float wx1,wy1,wx2,wy2,disp,pos,just;
char *text;
{
int refx, refy;
float shift, cc, ss, def, ht;
float xform[4], diag;
float 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);
}