This is setphy.c in view mode; [Download] [Up]
#include "plplot.h"
/* Sets up physical limits of plotting device and the mapping between */
/* normalized device coordinates and physical coordinates */
void setphy(xmin,xmax,ymin,ymax)
int xmin,xmax,ymin,ymax;
{
double xpmm, ypmm, mpxscl, mpyscl;
sphy(xmin,xmax,ymin,ymax);
sdp((double)(xmax-xmin),(double)xmin,(double)(ymax-ymin),(double)ymin);
gpixmm(&xpmm,&ypmm);
mpxscl = xpmm;
if (xmax <= xmin) mpxscl = -xpmm;
mpyscl = ypmm;
if (ymax <= ymin) mpyscl = -ypmm;
smp(mpxscl,(double)xmin, mpyscl,(double)ymin);
}
/* Sets up pixel size from the number of pixels/mm in each direction */
void setpxl(xpmm0,ypmm0)
double xpmm0,ypmm0;
{
spixmm(xpmm0,ypmm0);
sumpix((int)(1000./xpmm0),(int)(1000./ypmm0));
}
/* Sets up the subpage boundaries according to the current subpage */
/* selected */
void setsub()
{
int ix, iy;
int nsubx, nsuby, cursub;
double spdxmi, spdxma, spdymi, spdyma;
int sppxmi, sppxma, sppymi, sppyma;
gsub(&nsubx,&nsuby,&cursub);
ix = (cursub-1)%nsubx;
iy = nsuby - (cursub-1)/nsubx;
spdxmi = (double)(ix)/(double)(nsubx);
spdxma = (double)(ix+1)/(double)(nsubx);
spdymi = (double)(iy-1)/(double)(nsuby);
spdyma = (double)(iy)/(double)(nsuby);
sspd(spdxmi,spdxma,spdymi,spdyma);
sppxmi = dcpcx(spdxmi);
sppxma = dcpcx(spdxma);
sppymi = dcpcy(spdymi);
sppyma = dcpcy(spdyma);
sspp(sppxmi,sppxma,sppymi,sppyma);
sclp(sppxmi,sppxma,sppymi,sppyma);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.