home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d2xx
/
d222
/
plplot.lha
/
Plplot
/
src
/
source.zoo
/
plptex.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-15
|
1KB
|
45 lines
/* Prints out "text" at world cooordinate (x,y). The text may be */
/* at any angle "angle" relative to the horizontal. The parameter */
/* "just" adjusts the horizontal justification of the string: */
/* just = 0.0 => left hand edge of string is at (x,y) */
/* just = 1.0 => right hand edge of string is at (x,y) */
/* just = 0.5 => centre of string is at (x,y) etc. */
/* N.B. Centreline of the string passes through (x,y) */
#include "plplot.h"
#include <math.h>
void plptex(x,y,dx,dy,just,text)
float x,y,dx,dy,just;
char *text;
{
int refx, refy;
float shift, cc, ss;
float xform[4],diag;
float xscl, xoff, yscl, yoff;
int level;
glev(&level);
if (level < 3) fatal("Please set up window before calling PLPTEX.");
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;
xform[0] = cc;
xform[1] = -ss;
xform[2] = ss;
xform[3] = cc;
if (just != 0.0) shift = plstrl(text) * just;
refx = wcpcx(x) - shift * cc * xscl;
refy = wcpcy(y) - shift * ss * yscl;
plstr(0,xform,refx,refy,text);
}