This is plztx.c in view mode; [Download] [Up]
/* 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)
double dx,dy,wx,wy1,wy2,disp,pos,just;
char *opt, *text;
{
int refx, refy;
int vert;
double shift, cc, ss, def, ht;
double xform[4], diag;
double 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);
vert = 0;
refy = 0;
refx = 0;
if (stsearch(opt,'v')) {
vert = 0;
refx = mmpcx((double)(wcmmx(wx) - (disp * ht + shift) * cc));
refy = mmpcy((double)(wcmmy(wy) - (disp * ht + shift) * ss));
}
else if (stsearch(opt,'h')) {
vert = 1;
refy = wcpcy(wy) - yscl*(disp*ht*ss+shift);
refx = mmpcx((double)(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);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.