Changeset 152 for ttyvaders/trunk/libee/conic.c
 Timestamp:
 Nov 11, 2003, 11:22:19 AM (16 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

ttyvaders/trunk/libee/conic.c
r148 r152 50 50 } 51 51 52 void ee_ draw_ellipse(int xo, int yo, int a, int b, char c)52 void ee_fill_ellipse(int xo, int yo, int a, int b, char c) 53 53 { 54 54 int d2; … … 57 57 int d1 = b*b  (a*a*b) + (a*a/4); 58 58 59 while( a*a*y  a*a/2 > b*b*(x+1)) 60 { 61 if(d1 < 0) 62 { 63 d1 += b*b*(2*x+1); /* XXX: "Computer Graphics" has + 3 here. */ 64 } 65 else 66 { 67 d1 += b*b*(2*x*1) + a*a*(2*y+2); 68 ee_draw_line(xo  x, yo  y, xo + x, yo  y, c); 69 ee_draw_line(xo  x, yo + y, xo + x, yo + y, c); 70 y; 71 } 72 x++; 73 } 74 75 ee_draw_line(xo  x, yo  y, xo + x, yo  y, c); 76 ee_draw_line(xo  x, yo + y, xo + x, yo + y, c); 77 78 d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y1)*(y1)  a*a*b*b; 79 while(y > 0) 80 { 81 if(d2 < 0) 82 { 83 d2 += b*b*(2*x+2) + a*a*(2*y+3); 84 x++; 85 } 86 else 87 { 88 d2 += a*a*(2*y+3); 89 } 90 91 y; 92 ee_draw_line(xo  x, yo  y, xo + x, yo  y, c); 93 ee_draw_line(xo  x, yo + y, xo + x, yo + y, c); 94 } 95 } 96 97 void ee_draw_ellipse(int xo, int yo, int a, int b, char c) 98 { 99 int d2; 100 int x = 0; 101 int y = b; 102 int d1 = b*b  (a*a*b) + (a*a/4); 103 59 104 ellipsepoints(xo, yo, x, y, c); 60 105 … … 89 134 y; 90 135 ellipsepoints(xo, yo, x, y, c); 136 } 137 } 138 139 void ee_draw_thin_ellipse(int xo, int yo, int a, int b) 140 { 141 /* FIXME: this is not correct */ 142 int d2; 143 int x = 0; 144 int y = b; 145 int d1 = b*b  (a*a*b) + (a*a/4); 146 147 ellipsepoints(xo, yo, x, y, ''); 148 149 while( a*a*y  a*a/2 > b*b*(x+1)) 150 { 151 if(d1 < 0) 152 { 153 d1 += b*b*(2*x+1); /* XXX: "Computer Graphics" has + 3 here. */ 154 } 155 else 156 { 157 d1 += b*b*(2*x*1) + a*a*(2*y+2); 158 y; 159 } 160 x++; 161 ellipsepoints(xo, yo, x, y, ''); 162 } 163 164 d2 = b*b*(x+0.5)*(x+0.5) + a*a*(y1)*(y1)  a*a*b*b; 165 while(y > 0) 166 { 167 if(d2 < 0) 168 { 169 d2 += b*b*(2*x+2) + a*a*(2*y+3); 170 x++; 171 } 172 else 173 { 174 d2 += a*a*(2*y+3); 175 } 176 177 y; 178 ellipsepoints(xo, yo, x, y, ''); 91 179 } 92 180 }
Note: See TracChangeset
for help on using the changeset viewer.