# Changeset 132 for ttyvaders/trunk/libee/conic.cTweet

Ignore:
Timestamp:
Nov 10, 2003, 7:21:36 PM (17 years ago)
Message:
• libee/conic.c: + ee_draw_ellipse().
File:
1 edited

Unmodified
Added
Removed
• ## ttyvaders/trunk/libee/conic.c

 r130 } static void ellipsepoints(int xo, int yo, int x, int y, char c) { ee_putcharTO(xo + x, yo + y, c); ee_putcharTO(xo - x, yo + y, c); ee_putcharTO(xo + x, yo - y, c); ee_putcharTO(xo - x, yo - y, c); } void ee_draw_ellipse(int xo, int yo, int a, int b, char c) { int d2; int x = 0; int y = b; int d1 = b*b - (a*a*b) + (a*a/4); ellipsepoints(xo, yo, x, y, c); while( a*a*y - a*a/2 > b*b*(x+1)) { if(d1 < 0) { d1 += b*b*(2*x+1); /* XXX: "Computer Graphics" has + 3 here. */ } else { d1 += b*b*(2*x*1) + a*a*(-2*y+2); y--; } x++; ellipsepoints(xo, yo, x, y, c); } d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y-1)*(y-1) - a*a*b*b; while(y > 0) { if(d2 < 0) { d2 += b*b*(2*x+2) + a*a*(-2*y+3); x++; } else { d2 += a*a*(-2*y+3); } y--; ellipsepoints(xo, yo, x, y, c); } }
Note: See TracChangeset for help on using the changeset viewer.