1. Field of the Invention
The present invention relates to a circle drawing method for drawing a circle at high speed by a personal computer or the like on an output device such as a display, a printing device or the like.
2. Description of the Prior Art
There has been proposed a method for graphically outputting a circle by a personal computer or the like (Japanese Unexamined Patent Publication No. Hei 4-52776). In the method disclosed in the above-identified publication, a one-eighth fraction of a circle is drawn by a minimum axial distance method. In the minimum axial distance method, a function expressed by the following equation (1) is defined with respect to a known or determined point P.sub.i-1 (X.sub.i-1, Y.sub.i-1) on the circle. EQU f(Z.sub.i)=R.sup.2 {(X.sub.i-1 1/2).sup.2 +(Y.sub.i-1 +1).sup.2 } (1) EQU .DELTA.Y.sub.i-1 =2Y.sub.i-1 +1 (2) EQU .DELTA.X.sub.i-1 =2X.sub.i-1 +1 (3)
Then, depending upon the sign of the function f(Z.sub.i), coordinates of points to be plotted are determined for progressing drawing of a circle. For example, when, assuming a coordinate of a start point of drawing of a circle is (R, 0), a one-eighth fraction of the circle to the intersection with a straight line Y=X is to be drawn with increase of the Y coordinate, if the function f(Z.sub.i) is positive, the X coordinate is not reduced, and if the function f(Z.sub.i) is not positive, the X coordinate is reduced. When f(Z.sub.i)&gt;0 is established, the following equations (4) to (6) are established, and when f(Z.sub.i).ltoreq.0 is established, the following equations (7) to (9) are established. EQU f(Z.sub.i+1)=f(Z.sub.i)-.DELTA.Y.sub.i-1 (4) EQU .DELTA.Y.sub.i =.DELTA.Y.sub.i-1 +2 (5) EQU .DELTA.X.sub.i =.DELTA..sub.i-1 (6) EQU f(Z.sub.i+1)=f(Z.sub.i)-.DELTA.Y.sub.i+1 .DELTA.X.sub.i-1 (7) EQU .DELTA.Y.sub.i =.DELTA.Y.sub.i-1 +2 (8) EQU .DELTA.X.sub.i =.DELTA.X.sub.i-1 -2 (9)
Next, discussion will be given for the circle drawing method disclosed in the above-identified publication with reference to the drawings. FIGS. 1A to 1C are flowcharts illustrating a circle drawing method disclosed in the foregoing Japanese Unexamined Patent Publication No. Hei 4-52776. First, as shown in FIG. 1A, a coordinate of the center and a radius R of a circle to be drawn are input (step 101). Then, the input coordinate of the center is stored in a center coordinate storage means (step 102). Then, P.sub.1 (R, 0) as a drawing start point is determined. At this time, f(Z.sub.2)=R-5/4 is established. However, in order to avoid operation of fraction, the foregoing equations (1) to (9) are used as multiplied by four, in practice. Then, the drawing start point P.sub.1 (R, 0) is stored in a first storage means, and f(Z.sub.2)=4R-5 is stored in a f(Z.sub.i) value storage means. Furthermore, .DELTA.Y.sub.1 =4 is stored in a .DELTA.Y.sub.1. value storage means, and .DELTA.X.sub.1 =8R+4 is stored in a X.sub.i value storage means (step 103).
Next, the coordinate (R, 0) stored in the first storage means is transferred to a (Y=X) axis symmetric coordinate generating means (step 104). Then, a coordinate (0, R) symmetric to the coordinate (R, 0) with respect to the (Y=X) axis is derived. The coordinate (0, R) thus derived is stored in a second storage means (step 105). Next, the coordinate (R, 0) stored in the first storage means is transferred to an X-axis symmetric coordinate generating means (step 106). Then, a coordinate (R, 0) symmetric to the coordinate (R, 0) with respect to the X-axis is derived. The coordinate (R, 0) thus derived is stored in a third storage means (step 107). Furthermore, the coordinate (0, R) stored in the second storage means is transferred to the X-axis symmetric coordinate generating means (step 108). Then, a coordinate (0, -R) symmetric to the coordinate (0, R) with respect to the X-axis is derived. This coordinate (0, -R) is stored in a fourth storage means (step 109).
Next, the coordinate (R, 0) stored in the first storage means is transferred to a Y-axis symmetric coordinate generating means (step 110). Then, the coordinate (-R, 0) symmetric to the coordinate (R, 0) with respect to the Y-axis is derived. This coordinate (-R, 0) is stored in a fifth storage means (step 111). Then, as shown in FIG. 1B, the coordinate (0, R) stored in the second storage means is transferred to the Y-axis symmetric coordinate generating means (step 112). Then, the coordinate (0, R) symmetric to the coordinate (0, R) with respect to the Y-axis is derived. This coordinate (0, R) is stored in a sixth storage means (step 113). Furthermore, the coordinate (R, 0) stored in the third storage means is transferred to the Y-axis symmetric generating means (step 114). Then, the coordinate (-R, 0) symmetric to the coordinate (R, 0) with respect to the Y-axis is derived. The coordinate (-R, 0) thus derived is stored in a seventh storage means (step 115). Next, the coordinate (0, -R) stored in the fourth storage means is transferred to the Y-axis symmetric coordinate generating means (step 116). Then, the coordinate (0, -R) symmetric to the coordinate (0, -R) with respect to the Y-axis is derived. This coordinate (0, -R) is stored in an eighth storage means (step 117). These coordinates stored in the first to eighth storage means are plotted in a memory via a dot plotting means (step 118).
Next, as shown in FIG. 1C, the sign of f(Z.sub.2) is checked (step 119). If the sing of f(Z.sub.2) is positive, P.sub.2 (X.sub.1, Y.sub.1 +1)=(R, 1) is stored in the first storage means as the next coordinate (step 120). Then, f(Z.sub.3) for the next coordinate is calculated (step 121). Next, f(Z.sub.3) is stored in the (Z.sub.i) value storage means (step 122). Also, .DELTA.Y.sub.2 is calculated and stored in the .DELTA.Y.sub.i value storage means (step 123). Then, .DELTA.X.sub.2 is calculated and stored in the .DELTA.X.sub.i value storage means (step 124). Next, X.sub.i value and Y.sub.i value are compared for checking whether drawing of the one-eighth fraction of the circle is completed or not in the next coordinate. If not X.sub.i&gt;Y.sub.i, the operation is terminated as completed. If X.sub.i &gt;Y.sub.i, the process returned to the step 104 in FIG. 1A (step 130).
On the other hand, if f(Z.sub.2) is not positive as checked at the step 119, P.sub.2 (X.sub.1 -1, Y.sub.1 +1)=(R-1, 1) is stored in the first storage means (step 125). Then, the processes up to the comparison of X.sub.i value and Y.sub.i value are performed similarly to the case where the f(Z.sub.2) is positive (steps 126 to 130).
Next, discussion will be given for a method for deriving coordinate values to be stored in the first storage means until the one-eighth fraction of the circle is drawn. FIGS. 2A to 2G are diagrammatic illustrations showing points stored in the first storage means in sequential order. First, as shown in FIG. 2A, a point 201 has been determined as the drawing start point (R, 0). Then, as shown in FIG. 2B, the coordinate of the next point 202 is determined in response to the sign of f(Z.sub.2). In this case, since the sign of f(Z.sub.2) is positive, the Y coordinate is increased by one from the point 201 and the X coordinate is held unchanged. Next, f(Z.sub.3) is derived from f(Z.sub.2), .DELTA.X.sub.1 and .DELTA.Y.sub.1. The coordinate of the next point 203 is determined in response to the sign of f(Z.sub.3). In this case, as shown in FIG. 2C, since the sign of f(Z.sub.3) is positive, the Y coordinate is increased by one from the point 202, and the X coordinate is held unchanged. Furthermore, f(Z.sub.4) is derived from f(Z.sub.3), .DELTA.X.sub.2 and .DELTA.Y.sub.2, and the coordinate of the next point 204 is determined in response to the sign of f(Z.sub.4). In this case, as shown in FIG. 2D, since the sign of f(Z.sub.4) is not positive, the Y coordinate is increased by one and the X coordinate is decreased by one from the point 203.
Similarly, f(Z.sub.5) is derived. Depending upon the sign of f(Z.sub.5), the coordinate of the next point 205 is determined. In this case, as shown in FIG. 2E, since the sign of f(Z.sub.5) is positive, the Y coordinate is increased by one from the point 204, and the X coordinate is held unchanged. Then, f(Z.sub.6) is derived, and the coordinate of the next point 6 is determined in response to the sign of f(Z.sub.6). In this case, as shown in FIG. 2F, since the sign of f(Z.sub.6) is not positive, the Y coordinate is increased by one and the X coordinate is decreased by one from the point 205. Furthermore, f(Z.sub.7) is derived, and the coordinate of the next point 7 is determined in response to the sign of f(Z.sub.7). In this case, as shown in FIG. 2G, since the sign of f (Z.sub.7) is not positive, the Y coordinate is increased by one and the X coordinate is decreased by one from the point 206. Then, since X=Y is established at the coordinate of the point 7, calculation of the coordinates of the one-eighth fraction of the circle is completed. It should be noted that, while not illustrated, points symmetric to respective points 201 to 207 with respect to the (Y=X) axis, the X-axis and/or the Y-axis are derived sequentially.
By the circle drawing method disclosed in Japanese Unexamined Patent Publication No. Hei 4-52776, a full circle is drawn by calculating a one-eighth fraction by the minimum axial direction method. Therefore, a circle can be drawn at high speed.
However, in the foregoing conventional circle drawing method, all of f(Z.sub.i), .DELTA.X.sub.i and .DELTA.Y.sub.i have to be calculated for calculating each coordinate point. When a radius of a circle to be drawn becomes large, a circumferential length becomes long to increase number of points to be calculated. Therefore, when large amount of calculation has to be performed for deriving each coordinate point as the foregoing conventional method, number of process steps increases significantly according to increasing of radius. Thus, process period becomes significantly long. On the other hand, since respective points calculated are stored in respective of the first to eighth storage means at every occasion, memory region for these points is necessary. Thus, large memory region used for drawing a circle becomes required.