I’ve received a few requests over the last several weeks for methods to approximate elliptical arcs with quad. Beziers for an ellipse that is rotated at an arbitrary angle. Further, the requests were for straight actionscript; no Flex and no Degrafa. Oh well, not as fun, but your wish is my command 🙂
I originally worked with this algorithm for a cubic Bezier approximation in a computational geometry class in 1981. I don’t have an original attribution for the algorithm, but suspect it goes back to the 1970’s. Fortunately, the quad. case is easier, although strict error analysis is still tricky. For ellipses with major/minor axes of a few hundred px, it seems that approximating the arc in segments spanning no more than PI/8 is an acceptable starting heuristic. You may need something more sophisticated for much larger cases.
A screenshot of the demo (Flash CS3) is shown below. The code is straight AS on the timeline; no frills, no classes, just a straightforward implementation of the algorithm.
The code draws a simple wedge. You can download it here. If there is sufficient interest, I might incorporate this into Degrafa (whose elliptical arc class does not take rotation into account if memory serves).