• After sneaking and testing, got this:

    function ellipse(int xm, int ym, int a, int b)
    {
       var dx = 0;
       var dy = b;
       var a2 = a*a
       var b2 = b*b;
       var err = b2-(2*b-1)*a2
       var e2; /* Fehler im 1. Schritt */
    
       do {
           g.setPixel(xm+dx, ym+dy); 
           g.setPixel(xm-dx, ym+dy); 
           g.setPixel(xm-dx, ym-dy); 
           g.setPixel(xm+dx, ym-dy); 
    
           e2 = 2*err;
           if (e2 <  (2*dx+1)*b2) { dx++; err += (2*dx+1)*b2; }
           if (e2 > -(2*dy-1)*a2) { dy--; err -= (2*dy-1)*a2; }
       } while (dy >= 0);
    
       while (dx++ < a) { 
           g.setPixel(xm+dx, ym); 
           g.setPixel(xm-dx, ym);
       }
    }
    

    @Gordon, would it be worth the effort (original source )?


    1 Attachment

    • Bildschirmfoto 2019-12-05 um 19.11.40.jpg
About

Avatar for MaBe @MaBe started