next up previous contents
Next: About this document ... Up: Drawing an elliptical arc Previous: error estimation   Contents

Implementation

An implementation in the Java language of the algorithms explained in this paper is available in source form as a stand-alone file at http://www.spaceroots.org/documents/ellipse/EllipticalArc.java.

It is designed as an implementation of the java.awt.Shape interface and can therefore be drawn easily as any of the more traditional shapes provided by the standard Java API.

This class differs from the java.awt.geom.Ellipse2D in the fact it can handles parts of ellipse in addition to full ellipses and it can handle ellipses which are not aligned with the x and y reference axes of the plane.

Another improvement is that this class can handle degenerated cases like for example very flat ellipses (semi-minor axis much smaller than semi-major axis) and drawing of very small parts of such ellipses at very high magnification scales. This imply monitoring the drawing approximation error for extremely small values. Such cases occur for example while drawing orbits of comets near the perihelion.

When the arc does not cover the complete ellipse, the lines joining the center of the ellipse to the endpoints can optionally be included or not in the outline, hence allowing to use it for pie-charts rendering. If these lines are not included, the curve is not naturally closed.


next up previous contents
Next: About this document ... Up: Drawing an elliptical arc Previous: error estimation   Contents
Luc Maisonobe 2005-05-29