home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d2xx
/
d222
/
plplot.lha
/
Plplot
/
src
/
source.zoo
/
plw3d.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-05-15
|
2KB
|
63 lines
/* Set up a window for three-dimensional plotting. The data are mapped */
/* into a box with world coordinate size "basex" by "basey" by "height", */
/* with the base being symmetrically positioned about zero. Thus */
/* the mapping between data 3-d and world 3-d coordinates is given by: */
/* x = xmin => wx = -0.5*basex */
/* x = xmax => wx = 0.5*basex */
/* y = ymin => wy = -0.5*basey */
/* y = ymax => wy = 0.5*basey */
/* z = zmin => wz = 0.0 */
/* z = zmax => wz = height */
/* The world coordinate box is then viewed from position "alt"-"az", */
/* measured in degrees. For proper operation, 0 <= alt <= 90 degrees, */
/* but az can be any value. */
#include "plplot.h"
#include <math.h>
#define dtr 0.01745329252
void plw3d(basex,basey,height,xmin0,xmax0,ymin0,ymax0,zmin0,zmax0,alt,az)
float basex, basey, height, xmin0, xmax0, ymin0, ymax0, zmin0, zmax0;
float alt, az;
{
float xmin, xmax, ymin, ymax, zmin, zmax, d;
float cx, cy, saz, caz, salt, calt, zscale;
int level;
glev(&level);
if (level < 3) fatal("Please set up 2-d window before calling PLW3D.");
if (basex <= 0.0 || basey <= 0.0 || height <= 0.0)
fatal("Invalid world coordinate boxsize in PLW3D.");
if (xmin0 == xmax0 || ymin0 == ymax0 || zmin0 == zmax0)
fatal("Invalid axis range in PLW3D.");
if (alt<0.0 || alt>90.0)
fatal("Altitude must be between 0 and 90 degrees in PLW3D.");
d = 1.0e-5*(xmax0-xmin0);
xmax = xmax0 + d;
xmin = xmin0 - d;
d = 1.0e-5*(ymax0-ymin0);
ymax = ymax0 + d;
ymin = ymin0 - d;
d = 1.0e-5*(zmax0-zmin0);
zmax = zmax0 + d;
zmin = zmin0 - d;
cx = basex/(xmax-xmin);
cy = basey/(ymax-ymin);
zscale = height/(zmax-zmin);
saz = sin(dtr*az);
caz = cos(dtr*az);
salt = sin(dtr*alt);
calt = cos(dtr*alt);
sdom(xmin,xmax,ymin,ymax);
srange(zscale,zmin,zmax);
sbase(basex,basey,0.5*(xmin+xmax),0.5*(ymin+ymax));
sw3wc(cx*caz,-cy*saz,cx*saz*salt,cy*caz*salt,zscale*calt);
}