The SuperBitmap class now has a drawEllipse() function. Another one off the SourceForge list.
I “borrowed” the function from this site:
I’m not entirely sure what the licence for this is. It’s an implementation of Doug McIlroy’s (Bell Labs?) ellipse function written as part of an academic paper by someone else. The program it relates to is a graphing program with a BSD-like licence, so as Woopsi follows a similar licence I don’t imagine including it will be a problem. I’ve included an attribution comment anyway.
That site also includes a function for creating filled ellipses using filled rectangles which are, of course, Woopsi’s forte. However, the code is written in my least favourite way - short, meaningless variables. Here’s a snippet:
long t = -a2*y; long dxt = 2*b2*x, dyt = -2*a2*y; long d2xt = 2*b2, d2yt = 2*a2;
I bet the guys he works with love picking up his projects when he moves on to something else…
The code doesn’t compile because of signed/unsigned comparisons, and the obvious quick-fix doesn’t work. I’ll have to read the whole paper and re-write the function so that I can understand everything it’s doing and fix the problems.
If you’re trying to illustrate a point with code, use descriptive variable names. Honestly. In fact, always use descriptive variable names.
The most interesting thing about the ellipse problem is that McIlroy’s original missive, “Getting Raster Ellipses Right”, doesn’t seem to be available on the internet anywhere, despite being referenced just about every time rasterised ellipse functions are mentioned.