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

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.


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][3][4][5][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  = 1.
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.

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  +1 ,  +1 .
Substituting Δ =  = 2 − , where  is an integer (usually  ≥ 3), 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 cos  and sin .For example, by replacing trigonometric functions by truncated Taylor series one gets socalled simultaneous DDA algorithms [3].The determinant of the rotation matrix is 1.Matrices of DDA algorithms have different determinants and det  ≈ 1 only approximately.The closer it equals 1 the more accurate is the corresponding circular interpolator [2].Approximating cos  ≈ 1 and sin  ≈ , we obtain the simplest (and least accurate) DDA algorithm [2,11]: Much more accurate algorithm is obtained using cos  ≈ 1 − ( 2 /2) and sin  ≈  [7,12,13]: Approximating cos  and sin  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: (16) with initial conditions:  0 = ,  0 = 0,  1 =  cos , and  1 =  sin , 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 −1 ≤  ≤ 2  [2,12,15].Obviously, the greatest error will occur when  = 2  .In Table 1 we give maximum values of the absolute radial systematic errors for  = 2  and  = 2(1/) = [22  ], that is, for the full circle generation.Initial conditions are chosen to be  0 = 0,  0 = .
Apart from radial error an important role in such devices (especially in computer numerical control (CNC) interpolators) is played by the chord error  ch [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 Δ = √8/ at  ch = 1 (we recall that Δ ≡ ); that is Since the CNC systems radius can reach value  max = 10 8 BLU, the CNC interpolators angles range Δ =  = 2 − , where  = 3, 12 overlapping all possible radius values range (the though adopted algorithms can work and at  > 12).
In Table 2 we give maximum values of absolute radial systematic error for most accurate algorithms in case  = 2 2+3 .
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].

New DDA Algorithms
In the proposed two-step DDA algorithm the values  +2 and  +2 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  +2 ,  +2 ; see Figure 2. Hence, we obtain the following equations: From ( 20) we obtain values  +1 and − +1 : 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 which can easily be reduced to that is, to (18).The algorithm works with initial conditions:  0 = ,  0 = 0,  1 =  cos , and  1 =  sin , where  = 2  ( is an integer).Approximating sin  ≈  one can transform (18) into another two-step algorithm: with  0 = ,  0 = 0,  1 =  √ 1 −  2 ,  1 = .This algorithm was first proposed in [9]; see also [10].Functional diagram of interpolator which reproduces (26) is shown in Figure 3 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  = 2 2+3 .Note that results given in Tables 1 and 2 do not include round-off errors; hence they do not depend on .x n , y n x n+1 , y n+1 x n+2 , y n+2 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  = 2 2+3 .
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  = 2  ( = 10) and  = 24 given in Tables 3 and 5. Consequently, we will get that an absolute Modelling and Simulation in Engineering   radial error is smaller by (max(Table 5))/(max(Table 3)) = (1.267− 5)/(6.792− 6) = 1.876 times.We also see that the smaller is , the greater is the difference between the corresponding errors of both algorithms.For example, for ( = 3) and  = 32 we obtain that an absolute radial error is smaller by (max(Table 6))/ (max(Table 4)) = (7.781−4)/(4.533−10)≈ 1716523 times.
Finally, Figures 4, 5, 6, and 7 present numbers of correct bits as a function of , for  = 2  and  = 2 2+3 and for  = 24 and  = 32, respectively.Presented figures clearly show that the proposed algorithm (26) yields greater number of correct bits in comparison to algorithm (11).

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.

Figure 1 :
Figure 1: Rotation of vector  in the coordinate plane -.

Figure 2 :Figure 3 :
Figure 2: Generation of 3 subsequent points along the circle.

Figure 4 :
Figure 4: Number of correct bits of result as a function of  at  = 2  and  = 24.

Figure 5 :
Figure 5: Number of correct bits of result as a function of  at  = 2 2+3 and  = 24.

Figure 6 :
Figure 6: Number of correct bits of result as a function of  at  = 2  and  = 32.

Figure 7 :
Figure 7: Number of correct bits of result as a function of  at  = 2 2+3 and  = 32.
. Interpolator contains 6 registers (Register 1, Register 2, Register 3, Register 4, Output- +2, , and Output- +2 ), 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  0 and  0 are recorded in Register 2 and Register 4, respectively, while values of  1 and  1 are recorded in Register 1 and Register 3.Then, values of  +1 and   are stored in Register 1 and Register 2, and values of  +1 and   .are stored in Register 3 and Register 4. Right Shift Register 1 and Right Shift Register 2 perform multiplication of values  +1 and  +1 by 2.Thus, at outputs of subtractor and adder parallel binary codes are formed in accordance with (26).Rounded values are recorded in Output  +2 and Output  +2 .