Modelling and Simulation in Engineering

Volume 2014 (2014), Article ID 916539, 6 pages

http://dx.doi.org/10.1155/2014/916539

## A Comparison of Standard One-Step DDA Circular Interpolators with a New Cheap Two-Step Algorithm

^{1}Lviv Polytechnic National University, S. Bandery Street 12, Lviv 79013, Ukraine^{2}Uniwersytet w Białymstoku, Wydział Fizyki, ul. Lipowa 41, 15-424 Białystok, Poland

Received 28 June 2013; Accepted 21 October 2013; Published 20 January 2014

Academic Editor: Jing-song Hong

Copyright © 2014 Leonid Moroz et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

#### 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 [2–6]. 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.

#### References

- W. Wang and C. Wang, “Difference method for generation of circular arcs and ellipses,”
*Computer-Aided Design*, vol. 21, no. 1, pp. 33–37, 1989. View at Google Scholar · View at Scopus - N. Matsushiro, “A new digital differential analyzer for circle generation,”
*IEICE Transactions on Information and Systems*, vol. E81-D, no. 2, pp. 239–242, 1998. View at Google Scholar · View at Scopus - I. Chami, “A high precision digital differential analyzer for circular interpolation,”
*Tishreen University Journal*, vol. 29, no. 1, 2007. View at Google Scholar - H. Hama and T. Okumoto, “Fast transform into polar coordinate by generalized DDA,”
*Journal of the Institute of Television Engineers of Japan*, vol. 47, no. 1, pp. 97–100, 1993. View at Google Scholar - X. Y. Fan, Y. H. Guo, and S. C. Li, “New digital differential analyzer interpolation algorithm,”
*Advanced Science Letters*, vol. 6, no. 1, pp. 692–695, 2012. View at Publisher · View at Google Scholar - X. L. Yan, W. L. Wang, and N. Xue, “Research and simulation of an efficient circular interpolation algorithm,”
*Advanced Materials Research*, vol. 542-543, pp. 1204–1208, 2012. View at Publisher · View at Google Scholar - O. Masory and Y. Koren, “Reference-word circular interpolators for CNC systems,”
*Journal of Engineering for Industry*, vol. 104, no. 4, pp. 400–405, 1982. View at Google Scholar · View at Scopus - Y. Katayama, H. Harasaki, and M. Yano, “Parallel algorithm of three dimensional digital differential analyzer,” in
*Proceedings of the Annual Convention ITE Japan*, pp. 185–186, 1993. - L. V. Moroz, “A method for studying characteristics of digital sine-cosine generators,”
*Information Extraction and Processing*, vol. 36, no. 112, pp. 84–90, 2012 (Ukrainian). View at Google Scholar - J. L. Cieśliński and L. V. Moroz, “Fast exact digital differential analyzer for circle generation,” http://arxiv.org/abs/1304.4974.
- W. M. Newman and R. F. Sproull,
*Principles of Interactive Computer Graphics*, McGraw-Hill, 1979. - F. S. Lim, Y. S. Wong, and M. Rahman, “Circular interpolators for numerical control: a comparison of the modified DDA techniques and an LSI interpolator,”
*Computers in Industry*, vol. 18, no. 1, pp. 41–52, 1992. View at Google Scholar · View at Scopus - R. F. Eschenbach and B. M. Oliver, “An efficient coordinate rotation algorithm,”
*IEEE Transactions on Computers*, vol. 27, no. 12, pp. 1178–1180, 1978. View at Publisher · View at Google Scholar - H. Hasegawa and Y. Okada, “Apparatus and method for controlling a moving vehicle utilizing a digital differential analysis circuit,”
*US Patent*5379353, 1995. View at Google Scholar - C. Pokorny Computer Graphics,
*An Object Oriented Approach to the Art and Science*, Franklin, Beedle & Associates Publishing, 1994. - J. L. Cieśliński and B. Ratkiewicz, “On simulations of the classical harmonic oscillator equation by difference equations,”
*Advances in Difference Equations*, vol. 2006, Article ID 40171, 2006. View at Publisher · View at Google Scholar · View at Scopus - J. L. Cieśliński, “On the exact discretization of the classical harmonic oscillator equation,”
*Journal of Difference Equations and Applications*, vol. 17, no. 11, pp. 1673–1694, 2011. View at Publisher · View at Google Scholar · View at Scopus