function circle(xm, ym, r) {
var x = -r,
y = 0,
err = 2 - 2 * r;
do {
g.setPixel(xm - x, ym + y);
g.setPixel(xm - y, ym - x);
g.setPixel(xm + x, ym - y);
g.setPixel(xm + y, ym + x);
r = err;
if (r <= y) err += ++y * 2 + 1;
if (r > x || err > y) err += ++x * 2 + 1;
} while (x < 0);
}
The 'spikes' come from the optimized algorithm that can handle ellipses and circles incl. fill (4 auf einen Streich).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@JumJum ... or use this function to draw circle:
The 'spikes' come from the optimized algorithm that can handle ellipses and circles incl. fill (4 auf einen Streich).
1 Attachment