Annotation of researchv10no/libplot/libpen/parabola.c, revision 1.1

1.1     ! root        1: #include "pen.h"
        !             2: parabola(x0, y0, x1, y1, xb, yb)
        !             3: double x0, y0, x1, y1, xb, yb;
        !             4: {
        !             5:        register double t, x, y;
        !             6:        double d1, d2, dt;
        !             7:        double c0x,c0y,c1x,c1y;
        !             8:        if(noscale){
        !             9:        x0 = SCX(x0);
        !            10:        y0 = SCY(y0);
        !            11:        x1 = SCX(x1);
        !            12:        y1 = SCY(y1);
        !            13:        xb = SCX(xb);
        !            14:        yb = SCY(yb);
        !            15:        }
        !            16:        d1=sqrt((xb-x0)*(xb-x0)+(yb-y0)*(yb-y0));
        !            17:        d2=sqrt((xb-x1)*(xb-x1)+(yb-y1)*(yb-y1));
        !            18:        if (d1<=QUANTUM || d2<=QUANTUM) {
        !            19:                penUp();
        !            20:                fprintf(pltout,"PA %8.2f,%8.2f PD %8.2f,%8.2f",
        !            21:                        x0,y0,x1,y1);
        !            22:                penstate = DOWN;
        !            23:        }
        !            24:        else {
        !            25:                c0x = x0 + x1 - 2.*xb; 
        !            26:                c0y = y0 + y1 - 2.*yb; 
        !            27:                c1x = 2. * (xb - x0);
        !            28:                c1y = 2. * (yb - y0);
        !            29:                penUp();
        !            30:                fprintf(pltout,"PA %8.2f,%8.2f PD",x0,y0);      
        !            31:                penstate = DOWN;
        !            32:                dt = QUANTUM/d1;
        !            33:                for (t=dt; t < 1.0; t += dt) {  
        !            34:                        x = (c0x*t + c1x)*t + x0;
        !            35:                        y = (c0y*t + c1y)*t + y0;
        !            36:                        fprintf(pltout," %8.2f,%8.2f",x,y);
        !            37:                }
        !            38:                fprintf(pltout," %8.2f,%8.2f\n",x1,y1);
        !            39:        }
        !            40:        ckerr(0);
        !            41: }

unix.superglobalmegacorp.com

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