ftp.nice.ch/pub/next/unix/developer/plplot.3.0.s.tar.gz#/plplot/src/plwind.c

This is plwind.c in view mode; [Download] [Up]

#include "plplot.h"

void plwind(xmin,xmax,ymin,ymax)
double xmin, xmax, ymin, ymax;
{
    int vppxmi, vppxma, vppymi, vppyma;
    double dx, dy;
    double vpwxmi, vpwxma, vpwymi, vpwyma;
    double vpxmi, vpxma, vpymi, vpyma;
    double wpxscl, wpxoff, wpyscl, wpyoff;
    double wmxscl, wmxoff, wmyscl, wmyoff;
    int level;

    glev(&level);
    if (level<2) plexit("Please set up viewport before calling plwind.");

    gvpp(&vppxmi,&vppxma,&vppymi,&vppyma);
    gvpd(&vpxmi,&vpxma,&vpymi,&vpyma);

    dx = (xmax-xmin) * 1.0e-5;
    dy = (ymax-ymin) * 1.0e-5;

    if ((xmin == xmax) || (ymin == ymax))
        plexit("Invalid window limits in plwind.");

/* The true plot window is made slightly larger than requested so that */
/* the end limits will be on the graph  */

    svpw((xmin-dx),(xmax+dx),(ymin-dy),(ymax+dy));
    gvpw(&vpwxmi,&vpwxma,&vpwymi,&vpwyma);

/* Compute the scaling between coordinate systems */

    dx = vpwxma - vpwxmi;
    dy = vpwyma - vpwymi;

    wpxscl  = (vppxma - vppxmi) / dx;
    wpxoff  = (xmax * vppxmi - xmin * vppxma) / dx;
    wpyscl  = (vppyma - vppymi) / dy;
    wpyoff  = (ymax * vppymi - ymin * vppyma) / dy;
    swp(wpxscl,wpxoff,wpyscl,wpyoff);

    vpxmi = dcmmx(vpxmi);
    vpxma = dcmmx(vpxma);
    vpymi = dcmmy(vpymi);
    vpyma = dcmmy(vpyma);
    wmxscl = (vpxma - vpxmi) / dx;
    wmxoff = (xmax * vpxmi - xmin * vpxma) / dx;
    wmyscl = (vpyma - vpymi) / dy;
    wmyoff = (ymax * vpymi - ymin * vpyma) / dy;
    swm(wmxscl,wmxoff,wmyscl,wmyoff);

    slev(3);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.