Annotation of 41BSD/cmd/cifplot/edgepath.c, revision 1.1.1.1

1.1       root        1: /*******************************************************************
                      2: *                                                                  *
                      3: *    File: CIFPLOT/edgepath.c                                      *
                      4: *    Written by Dan Fitzpatrick                                    *
                      5: *    copyright 1980 -- Regents of the University of California     *
                      6: *                                                                  *
                      7: ********************************************************************/
                      8: 
                      9: #include <stdio.h>
                     10: #include "defs.h"
                     11: #include "globals.h"
                     12: #include "parser_defs.h"
                     13: #include "structs.h"
                     14: #include "out_structs.h"
                     15: #include "alloc.h"
                     16: 
                     17: 
                     18: static int xstart,ystart,xlast,ylast;
                     19: static PolyDesc *poly;
                     20: static transform *trans;
                     21: 
                     22: StartEdgePath(x,y,itrans,ipoly)
                     23: real x,y;
                     24: transform *itrans;
                     25: PolyDesc *ipoly;
                     26: {
                     27:     poly = ipoly;
                     28:     trans = itrans;
                     29:     Trans(&x,&y,trans);
                     30:     xstart = xlast = CONVERT(x);
                     31:     ystart = ylast = CONVERT(y);
                     32:     return;
                     33:     }
                     34: 
                     35: iedge *NextEdgePath(x,y)
                     36: real x,y;
                     37: {
                     38:     iedge *e;
                     39:     int t;
                     40:     int ix1,ix2,iy1,iy2;
                     41: 
                     42:     Trans(&x,&y,trans);
                     43:     ix1 = ix2 = CONVERT(x);    iy1 = iy2 = CONVERT(y);
                     44: 
                     45:     e = GetIEdge();
                     46:     e->type = EDGE;
                     47:     e->poly = poly;
                     48:     (poly->refs)++;
                     49:     if(xlast <= ix1) e->dir = 1;
                     50:       else {
                     51:        e->dir = -1;
                     52:        SWAP(xlast,ix1,t);
                     53:        SWAP(ylast,iy1,t);
                     54:        }
                     55:     /* xlast <= x */
                     56:     e->min = e->x1 = xlast;    e->y1 = ylast;
                     57:     e->x2 = ix1;               e->y2 = iy1;
                     58:     xlast = ix2;               ylast = iy2;
                     59:     return(e);
                     60:     }
                     61: 
                     62: iedge *EndEdgePath()
                     63: {
                     64:     iedge *e;
                     65:     int t;
                     66: 
                     67:     e = GetIEdge();
                     68:     e->type = EDGE;
                     69:     e->poly = poly;
                     70:     (poly->refs)++;
                     71:     if(xlast <= xstart) e->dir = 1;
                     72:       else {
                     73:        e->dir = -1;
                     74:        SWAP(xlast,xstart,t);
                     75:        SWAP(ylast,ystart,t);
                     76:        }
                     77:     e->min = e->x1 = xlast;    e->y1 = ylast;
                     78:     e->x2 = xstart;            e->y2 = ystart;
                     79:     return(e);
                     80:     }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.