How do I draw ellipse - Urgent

Hi everyone,

How do I draw ellipse to make an Easter egg to teach kids? I have looked at the libraries and there are only draw rect and circle. Anyone has any suggestions? Would appreciate any help.

Thank you.
Mai

http://www.mathematische-basteleien.de/eggcurves.htm

Google is amazing! Ever try it? :wink:

codeiscool:
Hi everyone,

How do I draw ellipse to make an Easter egg to teach kids? I have looked at the libraries and there are only draw rect and circle. Anyone has any suggestions? Would appreciate any help.

Thank you.
Mai

Here’s the drawEllipse code from my graphics VFD driver:

// draw an elipse from centered at X,Y with width and height as specified
void Noritake_VFD_GUU100::drawEllipse (int x, int y, uint8_t width, uint8_t height, uint8_t on)
{
    long x1 = -width, y1 = 0; // II quadrant from bottom left to top right
    long e2 = height, dx = (1 + 2 * x1) * e2 * e2; // error increment
    long dy = x1 * x1, err = dx + dy; // error of 1 step

    do {
        _setDot (x - x1, y + y1, on); // I Quadrant
        _setDot (x + x1, y + y1, on); // II Quadrant
        _setDot (x + x1, y - y1, on); // III Quadrant
        _setDot (x - x1, y - y1, on); // IV Quadrant
        e2 = 2 * err;

        if (e2 >= dx) {
            x1++;
            err += dx += 2 * (long) height * height;
        } // x1 step

        if (e2 <= dy) {
            y1++;
            err += dy += 2 * (long) width * width;
        } // y1 step
    } while (x1 <= 0);

    while (y1++ < height) { // too early stop for flat ellipses with width=1
        _setDot (x, y + y1, on); // -> finish tip of ellipse
        _setDot (x, y - y1, on);
    }
}