Abstract
Rendering circles on digital platforms is essential in computer graphics. The widely adopted midpoint circle algorithm is a premier tool for this task. This article dives deep into the foundational aspects of this algorithm, highlighting its prowess in enabling accurate and effortless circle depiction on digital displays. It further contrasts its merits with alternative circle drawing techniques. Importantly, our research presents a refined technique aimed at minimizing inaccuracies inherent in the standard cartesian-based Midpoint Circle Drawing Algorithm (MPCDA). By incorporating an error-reduction strategy, we ensure greater accuracy in depicting circles. Comparative tests on diverse circle sizes and placements confirmed the efficacy of our enhanced method. When set against results from the traditional MPCDA, our approach showcases significant improvements.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
1 Introduction
In the realm of computer graphics, representing perfect circles on digital canvases is a challenge that's long been faced by developers and designers. The Midpoint Circle Drawing Algorithm elegantly addresses this challenge, acting as a cornerstone technique for circle generation on raster displays. The algorithm harnesses the inherent symmetry of circles, allowing for efficient and accurate rendering. Instead of calculating every individual pixel value for a circle, it computes for just a segment and then extrapolates for the entire shape, thereby optimizing computational resources. This not only enhances the speed of rendering but also ensures precision, a critical aspect especially when graphics require exactness in representation. Whether it's in sophisticated graphic design software, video game renderings, or basic GUI elements in software applications, the ubiquity of this algorithm underscores its importance in the digital world. Its blend of mathematical simplicity with practical efficiency makes it a fundamental pillar in computer graphics.
In computer graphics, circle drawing stands as a foundational technique. Most graphics software, when generating graphs and visuals, relies heavily on this geometric shape. Over time, various methodologies have emerged for rasterizing circles on screens. Bresenham’s algorithm, introduced by Bresenham [1], remains the most notable circle creation technique, with its variations detailed in works by McIlroy [2] and Liu [3]. An advanced method, introduced by Wu and Rokne [4], offers scan conversion of lines and circles at twice the pixels per iteration, essentially quickening curve generation by increasing increment size. Their findings indicate that their double-step algorithms work as efficiently as single-step ones but with half the iterations. Kuzmin [5] proposed an incremental algorithm that, while producing results identical to Bresenham's, uses fewer arithmetic operations. Liu and Li [6] advocated for a double step circle drawing approach, relying solely on integer arithmetic, and demonstrated its superior speed compared to existing methods. Aken [7] showcased a highly precise midpoint algorithm for drawing ellipses on raster displays, emphasizing its accuracy even when Bresenham’s extended algorithm falls short. In a different vein, Kappel [8] combined previous techniques to formulate an optimized approach for drawing discrete ellipses. Similarly, Fellner et al. [9] have explored efficient algorithms for perfect ellipse approximations. Agathos et al. [10], inspired by Bresenham's methodology, introduced a fast method for rendering conic sections with alignment to coordinate axes. Their method was efficient, used a smaller integer range, and maintained accurate area transitions, even allowing for easy integration of antialiasing. Haiwen et al. [11], using a combined strategy, suggested swift techniques for ellipse drawing. Finally, according to Dimri et al. [12], the midpoint ellipse algorithm remains a preferred method for drawing ellipses, especially with techniques leveraging the reflection around the line x = y using the ellipse's parametric equation. In [13] proposed a method which efficiently detects concentric circles in grayscale images by combining the minimum envelopment circle and the least square ellipse fitting approach. Experimental results indicate superior detection performance compared to classical algorithms. In [14] proposed a circle detection algorithm that corrects elliptical distortions in optical CCD detection by employing ellipse de-falsification and various preprocessing techniques, including the use of RANSAC for outlier removal. The efficacy of this approach is evident in the experimental results, which highlight a minimal detection error of about 0.3%. In [15] presented two optimizations for the Dijkstra algorithm, focusing on urban express traffic: one enhances directional calculation to reduce computational load, and the other optimizes the graphical model by reducing node count. Comparative analysis validates the efficiency of their improved method, streamlining complexity and boosting practical applicability. The study of [16] introduces an approach to detecting multiple ellipses in data, treating the problem through the lens of cluster analysis and envisioning each ellipse as a Mahalanobis circle. By utilizing modified k-means and DIRECT algorithms, the method efficiently identifies ellipses even when their quantity is undetermined, with a novel Geometrical Objects-index (GO-index) assisting in selecting the optimal partition. Notably, while many existing algorithms falter with unclear or noisy ellipse edges, this method excels in such scenarios, as evidenced by numerous test examples.
In this study, we introduce a novel method to minimize errors in the prevailing MPCDA by employing diverse 'h' values to achieve optimal accuracy. The research article is structured into five distinct sections. Section 1 serves as the introduction and sheds light on the latest advancements related to MPCDA. Section 2 delves deeper into the intricacies of the midpoint circle drawing algorithm. In Sect. 3, we illustrate the method by plotting a circle with an 8-unit radius using various 'h' values. The findings are thoroughly discussed in Sect. 4, while Sect. 5 offers a comprehensive conclusion. The final segment of the paper lists the references.
2 Enhancements in Circle Rendering: A Dive into the Improved Algorithm
In our refined algorithm, the x and y coordinates' progression is contingent upon increments or decrements of 'h' units. Our initial focus is on plotting points within the first octant. Leveraging the inherent symmetry of circles, these points then guide the plotting in the subsequent octants. Specifically, for the first octant, plotting begins at the coordinate (0, r), where 'r' denotes the circle's radius.
Taking a circle centered at the origin with a radius of 'r' units, its equation can be defined as x2 + y2 = r2. From this, we derive a function f(x, y) represented as f(x, y) = x2 + y2 − r2. The circle encompasses all points (x, y) that satisfy f(x, y) = 0, assuming x and y as real values. Points satisfying f(x, y) < 0 are found within the circle, whereas those fulfilling f(x, y) > 0 lie outside the circle's boundary. This delineation is visually presented in Fig. 1.
Any point in the first octant may be chosen as (xk, yk), and it is assumed that this point is moving clockwise in the xy-plane. In the first octant, the next point to (xk, yk) is therefore provided by (xk + h, yk) or (xk + h, yk – h), where h is the grid's width. So long as (xm, ym) represents the midpoint between (xk + h, yk) and (xk + h, yk – h), we have
If Pk represents the value of f(x, y) at the mid-point (xm, ym), therefore,
Thus, Pk+1 will be given by,
where, xk+1 = xk + h and yk+1 = yk or yk – h. Thus, form Eq. (2), we have
On subtracting Eq. (1) from Eq. (3), and then simplifying, we get
2.1 Initial Decision Parameter
Let the initial point be (0, r), i.e., xk = 0 and yk = r, therefore from Eq. (1), we have
Thus,
If Pk ≥ 0, then yk+1 = yk – h and the next point will be (xk + h, yk – h), which gives
If Pk < 0, then yk+1 = yk and the next point will be (xk + h, yk), which gives
If we take h = 1, then the initial decision parameter from Eq. (5) is Pk = 1 − r and
gives the classical case of MPCDA.
3 Results
In this particular analysis, we are implementing the adjusted version of the midpoint circle drawing algorithm to graphically represent a circle, which is defined by a radius spanning 8 units. To simplify this task, we are focusing exclusively on pinpointing and plotting the points located within the first octant, or one-eighth segment of the circle. For this purpose, our starting point is designated as (0, 8).
A noteworthy aspect of this endeavor is the variable 'h'. We have chosen three distinct values for 'h' to examine how they influence the circle's representation. The chosen values are h = 1, h = 0.5, and h = 0.1. Detailed numerical breakdowns for each of these 'h' values are meticulously presented in three separate tables. Specifically, Table 1 is dedicated to the results for h = 1, Table 2 focuses on h = 0.5, and Table 3 encapsulates the data for h = 0.1. To visually illustrate how the circle appears based on these varying 'h' values within the first octant, we have prepared diagrams. Figures 2, 3, and 4 provide graphical representations of the circle corresponding to the 'h' values of 1, 0.5, and 0.1, respectively.
Moreover, we have taken it a step further. Beyond just the first octant, we also visualize how the circle is depicted within the entire first quadrant (or one-fourth of the circle) for the aforementioned 'h' values. This broader view can be observed in Figs. 5, 6, and 7, which correspond to the 'h' values of 1, 0.5, and 0.1, respectively.
In essence, this segment of the study provides both numerical and visual insights into how the modified midpoint circle drawing algorithm functions under different 'h' values, and the results they yield.
4 Discussion
In the research paper at hand, a novel methodology aimed at error minimization for the prevailing Midpoint Circle Drawing Algorithm (MPCDA) is introduced. One of the distinctive features of this approach is the incorporation of variable 'h' values. By fine-tuning these values, it becomes feasible to considerably lower the associated errors, pushing the limits of accuracy in circle rendering.
Proceeding to Sect. 2, a deep dive into the intricacies of the midpoint circle drawing algorithm is undertaken. Here, readers are offered a detailed understanding of the algorithm's core mechanics, functioning, and its foundational principles.
Section 3 transitions into a practical application of the discussed algorithm. In this segment, a circle, characterized by a radius measuring 8 units, is plotted. The unique aspect here is the deployment of diverse 'h' values during the plotting process, showcasing the algorithm's adaptability and the influence of varying 'h' values on the outcome.
Subsequently, Sect. 4 delves into a thorough discussion of the results obtained from the previously demonstrated example. This section aims to shed light on the implications, significance, and potential applications of the findings, making it crucial for those seeking actionable insights or future research directions.
5 Conclusion
In conclusion, the rendering of circles on digital platforms holds undeniable importance in the realm of computer graphics, and the widely embraced midpoint circle algorithm stands out as a premier tool for this fundamental task. Throughout this article, we have delved into the foundational aspects of the algorithm, shedding light on its remarkable capabilities in facilitating accurate and seamless circle depiction on digital displays. The significance of the midpoint circle algorithm becomes even more apparent as we contrast its merits with alternative circle drawing techniques. Its efficiency and effectiveness in achieving precision set it apart as a reliable choice for graphic rendering. However, acknowledging the inherent inaccuracies in the standard cartesian-based Midpoint Circle Drawing Algorithm (MPCDA), our research has introduced a refined technique. The core focus of our enhancement lies in the integration of an error-reduction strategy, aimed at minimizing inaccuracies that may arise during the rendering process. This nuanced approach ensures greater accuracy in depicting circles, addressing a key concern associated with the traditional MPCDA. The comparative tests conducted on diverse circle sizes and placements substantiate the efficacy of our enhanced method. When pitted against results obtained using the traditional MPCDA, our approach not only demonstrates its prowess but also showcases significant improvements. The refined technique not only preserves the strengths of the original algorithm but elevates its performance, making it a compelling choice for digital circle rendering in computer graphics.
In essence, the research presented here contributes to the ongoing evolution of circle rendering techniques, providing a valuable refinement to a widely adopted algorithm. As digital displays continue to play an increasingly integral role in various fields, the pursuit of accuracy and efficiency in graphical representation becomes paramount, and our enhanced midpoint circle algorithm contributes significantly to this endeavor.
Data Availability
The data used to support the findings of this study are included within the article. For simulation, we have used data from other research papers which are properly cited.
References
Bresenham J (1977) A linear algorithm for incremental digital display of circular arcs. Commun ACM 20:100–106
McIlroy MD (1983) Best approximate circles on integer grids. ACM Trans Graph 2:237–263
Liu YK (1993) Algorithm for circle approximation and generation. Comput Aided Des 25:169–171
Wu X, Rokne JG (1987) Double-step incremental generation of lines and circles. CVGIP 37:331–344
Kuzmin YP (1990) An efficient circle drawing algorithm. Comput Graph Forum 9:337–348
Liu YK, Li XN (2007) Double step circle drawing algorithm with and without grey scale. In: 4th International Journal of Image and Graphics, pp 886–891
Aken JV (1984) An efficient ellipse-drawing algorithm. IEEE Comput Graph Appl 4:24–35
Kappel MR (1985) An ellipse-drawing algorithm for raster displays. Fundam Algorithms Comput Graph 17:257–280
Fellner DW, Helmberg C (1994) Best approximate general ellipses on integer grids. Comput Graph 18:143–151
Agathos A, Theoharis T, Boehm A (1998) Efficient integer algorithms for the generation of conic sections. Comput Graph 22(5):621–628
Haiwen F, Lianqiang N (2012) A hybrid generating algorithm for fast ellipses drawing. In: International Conference on Computer Science and Information Processing (CSIP 2012), Xian, Shaanxi, pp 1022–1025
Dimri SC, Ram M (2017) An efficient algorithm to scan conversion of ellipse under auxiliary circle. Nonlinear Stud 24:181–191
Gu Y, Yang H, Huo J (2019) Concentric circle detection method based on minimum enveloping circle and ellipse fitting. In: 2019 IEEE 10th International Conference on Software Engineering and Service Science (ICSESS), Beijing, China, pp 523–527
Guo S, Yang S, Zhang P (2021) A circle detection algorithm based on ellipse removal. J Image Process Theory Appl 4(1):42–50
Bing H, Lai L (2022) Improvement and application of Dijkstra algorithms. Acad J Comput Inf Sci 5:97–102
Scitovski R, Sabo K, Nikic P, Majstorovic S (2023) A new efficient method for solving the multiple ellipse detection problem. Expert Syst Appl 222:119853
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of Interest
The authors declare that there are no conflicts of interest regarding publication of this manuscript.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Nithya, N.S., Idrisi, M.J. Enhancements in Circle Rendering: An Improved Approach to the Midpoint Circle Drawing Algorithm. Int J Netw Distrib Comput (2023). https://doi.org/10.1007/s44227-023-00016-7
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s44227-023-00016-7