Abstract

We present and study existing digital differential analyzer (DDA) algorithms for circle generation, including an improved two-step DDA algorithm which can be implemented solely in terms of elementary shifts, addition, and subtraction.

1. Introduction

Digital interpolation algorithms are widely used in machine tools with numerical control, graphics displays and plotters, and manipulation robots. Circles and circular arcs frequently appear in computer graphics, computer-controlled printing, and automated control; see [1]. One of most popular methods for generation of circles and arcs is known as digital differential analyzer (DDA). Digital circular interpolators (or angular sweep generators) based on DDA approach are widely used [26]. There are many papers where characteristics research results of such interpolators are systematized [7, 8].

In this paper a new improved two-step algorithm for DDA circle generation is presented. In paper [9] the idea of applying a Nystrom two-step scheme to circle generation appeared for the first time. Our next paper [10] developed theoretical and geometric aspects of this method. In the present paper we focus on practical and experimental issues. Moreover, here we consider circles of arbitrary radius , while in [9, 10] we assumed .

The accuracy of this method is higher than the accuracy of other known algorithms. Because of its simplicity (it uses only elementary shift, addition, and subtraction); this method can also be used in numerical control, planning mechanisms, and so forth.

2. DDA Algorithms

The general class of DDA algorithms for circles generation is based on obvious trigonometric transformations describing rotation of vector in the coordinate plane - (Figure 1); Advantages of DDA algorithms include simplicity and high speed in generating circle point coordinate , .

Substituting , where is an integer (usually ), we rewrite (1) as which, obviously, can be expressed by a rotation matrix :

To avoid expensive computation of trigonometric functions DDA algorithms use simpler (cheaper) expressions instead of and . For example, by replacing trigonometric functions by truncated Taylor series one gets so-called simultaneous DDA algorithms [3]. The determinant of the rotation matrix is 1. Matrices of DDA algorithms have different determinants and only approximately. The closer it equals 1 the more accurate is the corresponding circular interpolator [2]. Approximating and , we obtain the simplest (and least accurate) DDA algorithm [2, 11]: Much more accurate algorithm is obtained using and [7, 12, 13]: Approximating and with first two terms of Taylor series, we obtain the following algorithm [14]: Another second order scheme, different form truncated Taylor series, is proposed in [2]: All the above DDA algorithms have systematic radial error at each step, which is defined as In [7], given the recurrence relations for algorithms that do not have radial errors However, implementation of these algorithms requires floating point operations [7]. Replacing the coefficients of (9) with the first two terms of Taylor series [2], we obtain As a result we obtain, obviously, algorithm given by (7).

A lower level of radial error with much simpler hardware implementation can be achieved using the following algorithm [3, 13]: Another scheme worthwhile to be mentioned is the so-called “magic circle” interpolator [5, 7, 15]: This interpolator is more accurate than the simplest scheme (4) and requires the use of only two multipliers. However, in practice it is not used for large , because then the generated “circle” becomes an ellipse [2, 15].

There is also a group of sequential DDA algorithms [12]. Here are some of them: Two-step algorithm: with initial conditions: , , , and , is known as a “direct” or biquad form of the circular interpolator [14]. Note that its implementation needs only two multipliers.

In the process of circle points generation radial errors accumulate, and the law of accumulation is specific to a given algorithm. Note that in most cases, the circle radius is chosen to satisfy condition [2, 12, 15]. Obviously, the greatest error will occur when . In Table 1 we give maximum values of the absolute radial systematic errors for and , that is, for the full circle generation. Initial conditions are chosen to be , .

Apart from radial error an important role in such devices (especially in computer numerical control (CNC) interpolators) is played by the chord error [7], which should not exceed one basic length unit (BLU). Unlike radial error, the chord error does not accumulate. In [7] it is shown that for faster circle point generation for most accurate methods (5)–(7), (9) can be chosen from condition at (we recall that ); that is Since the CNC systems radius can reach value BLU, the CNC interpolators angles range , where overlapping all possible radius values range (the though adopted algorithms can work and at ).

In Table 2 we give maximum values of absolute radial systematic error for most accurate algorithms in case .

From these results we see that algorithm (11) is the most accurate. Therefore, in next sections we choose algorithm (11) in order to compare it with two new circular interpolators introduced in [10].

3. New DDA Algorithms

In the proposed two-step DDA algorithm the values and are determined by the following formula: This is an exact algorithm which can be derived as follows (for another approach, see [10]). We consider the rotation from the point , to , ; see Figure 2. Hence, we obtain the following equations: From (20) we obtain values and : Substituting values given by (21) into (20) we get Here we recognize the exact discretization of the classical harmonic oscillator equation [16, 17]. From (22) it follows that Substituting obtained values in (21), we get which can easily be reduced to that is, to (18). The algorithm works with initial conditions: , , , and , where ( is an integer). Approximating one can transform (18) into another two-step algorithm: with , , , . This algorithm was first proposed in [9]; see also [10].

Functional diagram of interpolator which reproduces (26) is shown in Figure 3. Interpolator contains 6 registers (Register 1, Register 2, Register 3, Register 4, Output—, and Output—), 2 multipliers (Right Shift Register 1 Right Shift Register 2), subtracter and adder.

In this scheme, at the beginning (before the interpolator starts) values of and are recorded in Register 2 and Register 4, respectively, while values of and are recorded in Register 1 and Register 3. Then, values of and are stored in Register 1 and Register 2, and values of and . are stored in Register 3 and Register 4. Right Shift Register 1 and Right Shift Register 2 perform multiplication of values and by . Thus, at outputs of subtractor and adder parallel binary codes are formed in accordance with (26). Rounded values are recorded in Output and Output .

Table 3 contains maximum values of absolute radial systematic error of proposed algorithm, given by (26), after full circle simulation in the case where is structure elements datapath (in bits) and is number of iterations. Table 4 contains the same data for case . Note that results given in Tables 1 and 2 do not include round-off errors; hence they do not depend on .

Analogical data for algorithm given by (11) are given in Table 5 (we consider, as before, case (27)). Table 6 contains the same data for .

Comparing errors in Tables 3 and 5, and in Tables 4 and 6, we see that the absolute radial errors of our algorithm (26) (Tables 3 and 4) are smaller than errors of well-known algorithm (11) (see Tables 5 and 6). For example, we can compare values of errors at and given in Tables 3 and 5. Consequently, we will get that an absolute radial error is smaller by times.

We also see that the smaller is , the greater is the difference between the corresponding errors of both algorithms. For example, for and we obtain that an absolute radial error is smaller by times.

Finally, Figures 4, 5, 6, and 7 present numbers of correct bits as a function of , for and and for and , respectively.

Presented figures clearly show that the proposed algorithm (26) yields greater number of correct bits in comparison to algorithm (11).

4. Conclusion

A new circle generation DDA algorithm has been proposed. In terms of hardware implementation and precision of circle generation the proposed DDA algorithm for circle interpolator is more efficient as compared with existing algorithms. We hope that the proposed algorithm will find some applications in computer graphics (display screens), computer-controlled printing, automated control, and so forth.

Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

Acknowledgment

The second author (Jan L. Cieśliński) is partly supported by the National Science Centre (NCN) Grant no. 2011/01/B/ST1/05137.