From: Jay Link (jlink@interlink-bbs.com)
Date: Tue 30 Nov 1999 - 15:06:11 IST
> ummm ... Jay ? > > maybe i'm missing something really obvious but i don't see how this will > give him a *filled* semi-circle ... can you enlighten me ? Alright, alright, Ivan you punk! :) So I forgot that gl_circle() draws a hollow circle. It was early. So sue me. At least I TRIED to answer, unlike other people on the list... :) Anyway, here's how you draw a filled CIRCLE: /* ============================================================== */ void rutgers_list_circle(int xc, int yc, int radius, int color) { double theta, costheta, sintheta; int i, y; for (i = 0; i < 360; i++) { theta = (PI / 360) * i; costheta = cos(theta); sintheta = sin(theta); y = yc + radius * costheta; gl_hline(xc - radius * sintheta, y, xc + radius * sintheta, color); } } /* ============================================================== */ Call that function just like you'd call gl_circle. Now, all you have to do to get a filled SEMI-circle is to alter the code a little bit: /* ============================================================== */ /* Bottom half -- change i's max value to 180 */ void semi_circle1(int xc, int yc, int radius, int color) { double theta, costheta, sintheta; int i, y; for (i = 0; i < 180; i++) { theta = (PI / 360) * i; costheta = cos(theta); sintheta = sin(theta); y = yc + radius * costheta; gl_hline(xc - radius * sintheta, y, xc + radius * sintheta, color); } } /* ============================================================== */ For the top half, make i go from 180 to 359 ( < 360). For left side or right side semi-circles, let i go from 0 to 359. Instead, alter the gl_hline() statement like so: gl_hline(xc - radius * sintheta, y, xc, color); I'm sure you get the picture. For semi-circles facing other directions, you will need to use gl_line() and two seperate y values. But, tra la, it's time for me to go to work. Perhaps IVAN will be so kind as to edify us on that one... ;P hehehe Have a good one & HTH, -Jay Link p.s. No hard feelings, Ivan.
This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:22 IST