Annotation of 42BSD/usr.lib/libplot/t300s/line.c, revision 1.1

1.1     ! root        1: #ifndef lint
        !             2: static char sccsid[] = "@(#)line.c     4.1 (Berkeley) 6/27/83";
        !             3: #endif
        !             4: 
        !             5: #include "con.h"
        !             6: line(x0,y0,x1,y1){
        !             7:        iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1)));
        !             8:        return;
        !             9: }
        !            10: cont(x0,y0){
        !            11:        iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0)));
        !            12:        return;
        !            13: }
        !            14: iline(cx0,cy0,cx1,cy1){
        !            15:        int maxp,tt,j,np;
        !            16:        char chx,chy,command;
        !            17:            float xd,yd;
        !            18:        float dist2(),sqrt();
        !            19:        movep(cx0,cy0);
        !            20:        maxp = sqrt(dist2(cx0,cy0,cx1,cy1))/2.;
        !            21:        xd = cx1-cx0;
        !            22:        yd = cy1-cy0;
        !            23:        command = COM|((xd<0)<<1)|(yd<0);
        !            24:        if(maxp == 0){
        !            25:                xd=0;
        !            26:                yd=0;
        !            27:        }
        !            28:        else {
        !            29:                xd /= maxp;
        !            30:                yd /= maxp;
        !            31:        }
        !            32:        inplot();
        !            33:        spew(command);
        !            34:        for (tt=0; tt<=maxp; tt++){
        !            35:                chx= cx0+xd*tt-xnow;
        !            36:                xnow += chx;
        !            37:                chx = abval(chx);
        !            38:                chy = cy0+yd*tt-ynow;
        !            39:                ynow += chy;
        !            40:                chy = abval(chy);
        !            41:                spew(ADDR|chx<<3|chy);
        !            42:        }
        !            43:        outplot();
        !            44:        return;
        !            45: }

unix.superglobalmegacorp.com

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