Annotation of researchv8dc/cmd/ideal/idfilt/aps.c, revision 1.1

1.1     ! root        1: #include "idfilt.h"
        !             2: 
        !             3: #define        RESOLUTION      720.0
        !             4: 
        !             5: float xscale, yscale;
        !             6: 
        !             7: void idjusttext (str)
        !             8: char *str;
        !             9: {
        !            10:        if (
        !            11:                strncmp (str, ".IE", 3) &&
        !            12:                strncmp (str, "...knot", 7) &&
        !            13:                strncmp (str, "...endspline", 12) &&
        !            14:                strncmp (str, "...left", 7) &&
        !            15:                strncmp (str, "...center", 9) &&
        !            16:                strncmp (str, "...right", 8)
        !            17:        )
        !            18:                fputs (str, stdout);
        !            19: }
        !            20: 
        !            21: void idstart ()
        !            22: {
        !            23: }
        !            24: 
        !            25: void idendbound ()
        !            26: {
        !            27:        if (boundset)
        !            28:                return;
        !            29:        idminx (-6.0);
        !            30:        idmaxy (6.0);
        !            31:        idmaxx (6.0);
        !            32:        idminy (-6.0);
        !            33:        if (!banzai && maxx - minx < 0.2) {
        !            34:                maxx += 1;
        !            35:                minx -= 1;
        !            36:        }
        !            37:        if (!banzai && maxy - miny < 0.2) {
        !            38:                maxy += 1;
        !            39:                miny -= 1;
        !            40:        }
        !            41:        xscale = width*RESOLUTION/(maxx - minx);
        !            42:        yscale = - xscale;
        !            43:        minx -= 0.5*(colwid - width)*RESOLUTION/xscale;
        !            44:        maxx += 0.5*(colwid - width)*RESOLUTION/xscale;
        !            45:        boundset = TRUE;
        !            46:        printf (".ne %4.2fi\n", yscale*(miny - maxy)/RESOLUTION);
        !            47: }
        !            48: 
        !            49: void idline (x1, y1, x2, y2)
        !            50: float x1;
        !            51: float y1;
        !            52: float x2;
        !            53: float y2;
        !            54: {
        !            55:        long int X1, Y1, X2, Y2;
        !            56:        boolean shortvert, shorthoriz, nonrectilinear;
        !            57:        X1 = round(xscale*x1);
        !            58:        Y1 = round(yscale*y1);
        !            59:        X2 = round(xscale*x2);
        !            60:        Y2 = round(yscale*y2);
        !            61:        shortvert = X1 == X2 && abs(Y1-Y2) < RESOLUTION/2;
        !            62:        shorthoriz = Y1 == Y2 && abs(X1-X2) < RESOLUTION/2;
        !            63:        nonrectilinear = X1 != X2 && Y1 != Y2;
        !            64:        if (wantquality || shortvert || shorthoriz || nonrectilinear)
        !            65:                printf ("\\h'%du'\\v'%du'\\D'l %du %du'\\h'%du'\\v'%du'\n.sp -1\n",
        !            66:                        round(xscale*(x1-minx)),
        !            67:                        round(yscale*(y1-maxy)),
        !            68:                        round(xscale*(x2-x1)),
        !            69:                        round(yscale*(y2-y1)),
        !            70:                        round(-xscale*(x2-minx)),
        !            71:                        round(-yscale*(y2-maxy))
        !            72:                );
        !            73:        else {
        !            74:                if (Y1 == Y2)
        !            75:                        printf ("\\h'%du'\\v'%du'\\l'%du'\\h'%du'\\v'%du'\n.sp -1\n",
        !            76:                                round(xscale*(x1-minx)),
        !            77:                                round(yscale*(y1-maxy)),
        !            78:                                round(xscale*(x2-x1)),
        !            79:                                round(-xscale*(x2-minx)),
        !            80:                                round(-yscale*(y2-maxy))
        !            81:                        );
        !            82:                if (X1 == X2)
        !            83:                        printf ("\\h'%du'\\v'%du'\\L'%du'\\h'%du'\\v'%du'\n.sp -1\n",
        !            84:                                round(xscale*(x1-minx)),
        !            85:                                round(yscale*(y1-maxy)),
        !            86:                                round(yscale*(y2-y1)),
        !            87:                                round(-xscale*(x2-minx)),
        !            88:                                round(-yscale*(y2-maxy))
        !            89:                        );
        !            90:        }
        !            91: }
        !            92: 
        !            93: void idcircle (x0, y0, r)
        !            94: float x0;
        !            95: float y0;
        !            96: float r;
        !            97: {
        !            98:        printf ("\\h'%du'\\v'%du'\\D'c %du'\\h'%du'\\v'%du'\n.sp -1\n",
        !            99:                round(xscale*(x0-r-minx)),
        !           100:                round(yscale*(y0-maxy)),
        !           101:                round(2*xscale*r),
        !           102:                round(-xscale*(x0+r-minx)),
        !           103:                round(-yscale*(y0-maxy))
        !           104:        );
        !           105: }
        !           106: 
        !           107: void idarc (x0, y0, x1, y1, x2, y2, t1, t2, r)
        !           108: float x0;
        !           109: float y0;
        !           110: float x1;
        !           111: float y1;
        !           112: float x2;
        !           113: float y2;
        !           114: float t1;
        !           115: float t2;
        !           116: float r;
        !           117: {
        !           118:        if (xscale*r > 30000.0)
        !           119:                idline (x1, y1, x2, y2);
        !           120:        else {
        !           121:                printf ("\\h'%du'\\v'%du'\\D'a %du %du %du %du'\\h'%du'\\v'%du'\n.sp -1\n",
        !           122:                        round(xscale*(x1-minx)),
        !           123:                        round(yscale*(y1-maxy)),
        !           124:                        round(xscale*(x0-x1)),
        !           125:                        round(yscale*(y0-y1)),
        !           126:                        round(xscale*(x2-x0)),
        !           127:                        round(yscale*(y2-y0)),
        !           128:                        round(-xscale*(x2-minx)),
        !           129:                        round(-yscale*(y2-maxy))
        !           130:                );
        !           131:        }
        !           132: }
        !           133: 
        !           134: void idleft (x, y, str)
        !           135: float x;
        !           136: float y;
        !           137: char *str;
        !           138: {
        !           139:        str == ++str;
        !           140:        printf ("\\h'%du'\\v'%du'%s\\h'-\\w\\(ts%s\\(tsu'\n.sp -1\n",
        !           141:                round(xscale*(x-minx)),
        !           142:                round(yscale*(y-maxy)),
        !           143:                str,
        !           144:                str
        !           145:        );
        !           146: }
        !           147: 
        !           148: void idcenter (x, y, str)
        !           149: float x;
        !           150: float y;
        !           151: char *str;
        !           152: {
        !           153:        str = ++str;
        !           154:        printf ("\\h'%du'\\v'%du'\\h'-\\w\\(ts%s\\(tsu/2u'%s\\h'-\\w\\(ts%s\\(tsu/2u'\n.sp -1\n",
        !           155:                round(xscale*(x-minx)),
        !           156:                round(yscale*(y-maxy)),
        !           157:                str,
        !           158:                str,
        !           159:                str
        !           160:        );
        !           161: }
        !           162: 
        !           163: void idright (x, y, str)
        !           164: float x;
        !           165: float y;
        !           166: char *str;
        !           167: {
        !           168:        str = ++str;
        !           169:        printf ("\\h'%du'\\v'%du'\\h'-\\w\\(ts%s\\(tsu'%s\\h'-\\w\\(ts%s\\(tsu'\n.sp -1\n",
        !           170:                round(xscale*(x-minx)),
        !           171:                round(yscale*(y-maxy)),
        !           172:                str,
        !           173:                str,
        !           174:                str
        !           175:        );
        !           176: }
        !           177: 
        !           178: void idendE ()
        !           179: {
        !           180:        if (boundset)
        !           181:                printf (".sp %du\n.sp 1\n.sp 1\n",
        !           182:                        round(yscale*(miny-maxy))
        !           183:                );
        !           184:        printf (".IE\n");
        !           185: }
        !           186: 
        !           187: void idendF ()
        !           188: {
        !           189: }
        !           190: 
        !           191: float osplx, osply;
        !           192: 
        !           193: void idspline (sx, sy)
        !           194: float sx, sy;
        !           195: {
        !           196:        osplx = sx;
        !           197:        osply = sy;
        !           198:        printf ("\\h'%du'\\v'%du'\\D'~",
        !           199:                round(xscale*(osplx-minx)),
        !           200:                round(yscale*(osply-maxy))
        !           201:        );
        !           202: }
        !           203: 
        !           204: void idknot (sx, sy)
        !           205: float sx, sy;
        !           206: {
        !           207:        printf (" %du %du",
        !           208:                round(xscale*(sx-osplx)),
        !           209:                round(yscale*(sy-osply))
        !           210:        );
        !           211:        osplx = sx;
        !           212:        osply = sy;
        !           213: }
        !           214: 
        !           215: void idendspline ()
        !           216: {
        !           217:        printf ("'\\h'%du'\\v'%du'\n.sp -1\n",
        !           218:                round(xscale*(minx-osplx)),
        !           219:                round(yscale*(maxy-osply))
        !           220:        );
        !           221: }
        !           222: 
        !           223: void idnoerase ()
        !           224: {
        !           225: }
        !           226: 
        !           227: 
        !           228: void idyeserase ()
        !           229: {
        !           230: }

unix.superglobalmegacorp.com

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