Browse Prior Art Database

General Method for Drawing Ellipses on Raster Graphics Devices

IP.com Disclosure Number: IPCOM000061579D
Original Publication Date: 1986-Aug-01
Included in the Prior Art Database: 2005-Mar-09
Document File: 3 page(s) / 17K

IBM

Related People

Makowka, CD: AUTHOR

Abstract

A technique is described for drawing all or part of an arbitrary ellipse onto a raster for devices such as a digital plotter, a raster display, or an all-points-addressable graphics printer. The ellipse may have any ratio of major or minor axis and any orientation relative to the coordinate axis of the graphic space.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 33% of the total text.

Page 1 of 3

General Method for Drawing Ellipses on Raster Graphics Devices

A technique is described for drawing all or part of an arbitrary ellipse onto a raster for devices such as a digital plotter, a raster display, or an all-points- addressable graphics printer. The ellipse may have any ratio of major or minor axis and any orientation relative to the coordinate axis of the graphic space.

The technique is unique in that the representation places the center of the ellipse at the origin rather than having the ellipse pass through the origin, as is done in the prior art. The general method for drawing the ellipse uses a distance squared criteria to select the raster points closest to the ideal curve of an ellipse. An algorithm divides a circle or ellipse into octants based on the slope and direction of the tangent vector to the curve, giving the instantaneous drawing motion. The octants consist of equal 45- degree increments in the angle of the tangent from the horizontal. For a circle, each octant contains 1/8th of the circumference of the circle. For an ellipse, the octants divide the circumference into unequal sections. To simplify the rastering equations, a translation is made so that the center of the arc is at the origin. Once the points have been rastered, they can be translated back to the correct location. In the actual drawing of the ellipse, the starting point is always assumed to lie exactly on the curve. Depending on the rastering direction (clockwise or counterclockwise) and the octant, exactly two neighboring points can be identified as candidates for the next point used to approximate the curve. One neighbor is reached by a straight (horizontal or vertical) move, while the other neighbor is reached by a diagonal move. A decision variable is used to select the move so as to obtain the point closest to the curve. At this new point, the entire process can be repeated to select the next point, and so on around the arc. The decision variable can be expressed as:

(Image Omitted)

where (X,Y) is the current point, is the straight move vector, is the diagonal move vector, and

(Image Omitted)

is the equation for the ellipse. The function f(x,y,) has the property that its magnitude is proportional to the square of the distance between the point (x,y) and the ellipse. Furthermore, the value of f(x,y) will be negative if the point (x,y) is inside the ellipse, O if the point (x,y) is on the ellipse and positive if the point (x,y) is outside of the ellipse. Since one of the two candidate points is typically inside the ellipse, while the other candidate point is outside the ellipse, the decision function measures the distance in nearness to the ellipse of the two candidate points. Therefore, the sign of the decision variable indicates which candidate point is closest to the ellipse. Using this decision variable, the closest point is reached by a straight move when the decision variable is positive for some octants. In other octants, a negativ...