home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d2xx
/
d222
/
plplot.lha
/
Plplot
/
src
/
source.zoo
/
plenv.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-15
|
3KB
|
85 lines
/* Simple interface for defining viewport and window. If "just"=1, */
/* X and Y scales will be the same, otherwise they are scaled */
/* independently. The "axis" parameter is interpreted as follows: */
/* axis=-2 : draw no box, axis or labels */
/* axis=-1 : draw box only */
/* axis= 0 : Draw box and label with coordinates */
/* axis= 1 : Also draw the coordinate axes */
/* axis= 2 : Draw a grid at major tick positions */
/* axis=10 : Logarithmic X axis, L!=r Y axis, No X=0 axis */
/* axis=11 : Logarithmic X axis, L!=r Y axis, X=0 axis */
/* axis=20 : L!=r X axis, Logarithmic Y axis, No Y=0 axis */
/* axis=21 : L!=r X axis, Logarithmic Y axis, Y=0 axis */
/* axis=30 : Logarithmic X and Y axes */
#include "plplot.h"
#include <math.h>
void plenv(xmin,xmax,ymin,ymax,just,axis)
int just,axis;
float xmin, xmax, ymin, ymax;
{
int level;
float chrdef, chrht;
float lb, rb, tb, bb, dx, dy;
float xsize, ysize, xscale, yscale;
float spxmin, spxmax, spymin, spymax;
float vpxmin, vpxmax, vpymin, vpymax;
float scale;
glev(&level);
if (level < 1) fatal("Please call PLSTAR before PLENV.");
if (xmin == xmax) fatal("Invalid xmin and xmax arguments in PLENV");
if (ymin == ymax) fatal("Invalid ymin and ymax arguments in PLENV");
if ((just != 0) && (just != 1)) fatal("Invalid just option in PLENV");
pladv(0);
if (just == 0)
plvsta();
else {
gchr(&chrdef,&chrht);
lb = 7.0 * chrht;
rb = 4.0 * chrht;
tb = 4.0 * chrht;
bb = 4.0 * chrht;
dx = fabs(xmax-xmin);
dy = fabs(ymax-ymin);
plgspa(&spxmin,&spxmax,&spymin,&spymax);
xsize = spxmax - spxmin;
ysize = spymax - spymin;
xscale = dx/(xsize - lb - rb);
yscale = dy/(ysize - tb - bb);
scale = max(xscale,yscale);
vpxmin = max(lb,0.5*(xsize - dx/scale));
vpxmax = vpxmin + (dx/scale);
vpymin = max(bb,0.5*(ysize - dy/scale));
vpymax = vpymin + (dy/scale);
plsvpa(vpxmin,vpxmax,vpymin,vpymax);
}
plwind(xmin,xmax,ymin,ymax);
if (axis == -2)
;
else if (axis == -1)
plbox("bc",0.0,0,"bc",0.0,0);
else if (axis == 0)
plbox("bcnst",0.0,0,"bcnstv",0.0,0);
else if (axis == 1)
plbox("abcnst",0.0,0,"abcnstv",0.0,0);
else if (axis == 2)
plbox("abcgnst",0.0,0,"abcgnstv",0.0,0);
else if (axis == 10)
plbox("bclnst",0.0,0,"bcnstv",0.0,0);
else if (axis == 11)
plbox("bclnst",0.0,0,"abcnstv",0.0,0);
else if (axis == 20)
plbox("bcnst",0.0,0,"bclnstv",0.0,0);
else if (axis == 21)
plbox("bcnst",0.0,0,"abclnstv",0.0,0);
else if (axis == 30)
plbox("bclnst",0.0,0,"bclnstv",0.0,0);
else
fatal("Invalid axis argument in plenv");
}