Annotation of researchv10no/cmd/ideal/idfilt/cv.c, revision 1.1

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

unix.superglobalmegacorp.com

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