Annotation of researchv10no/cmd/ideal/lib/dragfile, revision 1.1

1.1     ! root        1: To: cvw
        !             2: Subject: ideal library
        !             3: 
        !             4: There's also a library file that drag expects to be present,
        !             5: called "drag".  Do you mind if I install it in various ideal
        !             6: libraries (various as in the machines I use)?  Or perhaps
        !             7: you'd like to look at it and install it yourself.  Here it is:
        !             8: 
        !             9: 
        !            10: .IS
        !            11: ...libfile dash
        !            12: idaline { # line p1 to p2, for use in arrowhead (p3 unused)
        !            13:        var p1, p2, p3;
        !            14:        conn p1 to p2;
        !            15: }
        !            16: 
        !            17: arrowhead {
        !            18:        var tl, hd, perp, strokes;
        !            19:        perp = 0.1*(tl-hd)/abs(tl-hd);
        !            20:        conn hd+cis(25)*perp to hd+cis(-25)*perp
        !            21:                using strokes-1 idaline { p2=hd; }<p1,p3>;
        !            22:        conn hd+cis(-25)*perp to hd;
        !            23: }
        !            24: 
        !            25: thickline {
        !            26:        var tl, hd, perp;
        !            27:        perp = .01*cis(90)*(tl-hd)/abs(tl-hd);
        !            28:        conn tl-perp to tl+perp
        !            29:                using 4 idaline { p2=p1+hd-tl; }<p1,p3>;
        !            30: }
        !            31: 
        !            32: dashline {
        !            33:        var tl, hd;
        !            34:        conn tl to hd
        !            35:                using int(abs(hd-tl)/.1 + .99) dash{}<start,end>;
        !            36: }
        !            37: 
        !            38: selfloop { # loop from c to itself, passing through e, with arrowhead
        !            39:        var c, e, h, i, c1, c2, c3, c4, s;
        !            40:        var B, C, D;
        !            41:        B ~ .6; C ~ .6; D ~ .2;
        !            42:        h = e + B*(e-c)*cis(90);
        !            43:        i = e + B*(e-c)*cis(-90);
        !            44:        c1 = C[c,h];
        !            45:        c4 = C[c,i];
        !            46:        c2 = D[e,h];
        !            47:        c3 = D[e,i];
        !            48:        spline c to c1 to c2 to c3 to c4 to c;
        !            49:        put arrowhead { hd=c; tl=c4; strokes=s; };
        !            50: }
        !            51: 
        !            52: selfloopc { # loop from a to b, passing through e, with arrowhead at b
        !            53:            # c is "center": ce is perpendicular to tangent at e
        !            54:        var a, b, c, d, e, h, c1, c2, c3, c4, s;
        !            55:        var A, C, D;
        !            56:        A ~ .8; C ~ .2; D ~ .4;
        !            57:        d = c - A*(e-c);
        !            58:        c1 = a + C*(a-d);
        !            59:        c4 = b + C*(b-d);
        !            60:        h = d + (c1-d)*abs(e-d)/abs((c1+c4)/2-d);
        !            61:        c2 = D[e,h];
        !            62:        c3 = e-(c2-e);
        !            63:        spline a to c1 to c2 to c3 to c4 to b;
        !            64:        put arrowhead { hd=b; tl=c4; strokes=s; };
        !            65: }
        !            66: .IE

unix.superglobalmegacorp.com

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