Best Papers of CAD & CG 2001BRDC: binary representation of displacement code for line
Introduction
Line is one of the most fundamental elements in computer graphics. In raster graphics, a line is displayed as a sequence of connected pixels, which best approximate the line with minimum deviation. Many efforts have been paid to developing efficient line drawing algorithms [1]. These algorithms can be classified into two types. One type relates to single-step algorithms, which generate one pixel on the line during each iteration. The other relates to multi-step algorithms, which generate multiple successive pixels on the line during each iteration. One of the best-known single-step algorithms is the Bresenham algorithm [2] proposed by Bresenham in 1965, which involves only arithmetic operations of integers, i.e., one integer addition and one sign judgment for each pixel’s generation. Because of its simplicity, it is well-suited for hardware implementation. Many attempts [3], [4], [5], [6], [7], [8] later have been tried to improve the efficiency of the Bresenham algorithm. One way to accelerate the line drawing process is generating multiple pixels on the line during each iteration [9], [10], [11], [12], [13]. Taking advantage of the symmetry of a line from either endpoint, the bi-directional method is proposed in [9] to draw a line from both directions. The double-step algorithm in [10] generates two pixels each time according to the line’s slope. Also in [11] a triple-step approach is proposed. Bao et al. analyzed all the possible configurations of four pixels, called the quadruple-step running codes of line, and proposed a Quad-step algorithm in [12]. A general N-step method proposed in [13] considers even larger steps to accelerate the process of line drawing. In these multi-step algorithms, a pre-determined fixed number, for example 2, 3, or 4 etc, of pixels are generated at each iteration. In addition, there are some other adaptive multi-step algorithms [14], [15], [16], [17], which adaptively determines the step according to the slopes of the lines. In [17], three kinds of pixel approximations of a line are discussed, and a new algorithm is given, which is 20 times faster than the original Bresenham algorithm.
After reviewing the published line drawing algorithms, we found that the entire line drawing process can be represented by the displacement codes, which record the displacement of each pixel on the line to its immediate predecessor pixel on the line. The major difference between various line drawing algorithms is how they determine the displacement code. The binary representation of displacement code (BRDC) is interesting for addressing line drawing problem, because: (1) For a given line, its BRDC is unique, and (2) the BRDC of a line can be determined prior according to its slope. (3) BRDC has lots of nice properties, which can be employed to improve the line drawing process. In the next section of this paper, we will first give a formal definition of BRDC. Then we examine the important properties of the BRDC, including calculation formula, periodicity, decomposition, etc. in 3 Properties of BRDC, 4 Decomposition of BRDC. Then in Section 5, we put forward an adaptive multi-pixel line drawing algorithm based on the BRDC, and we show that the BRDC is significant for designing efficient line drawing algorithms. In the last section some future work are addressed.
Section snippets
Definition of BRDC
A raster graphics display is logically a 2D grid of pixels as shown in Fig. 6. The task of drawing a line is to determine which pixels belong to the line. Due to the limited resolution of the display, it is an approximation process. For example, L is a line from A(xa,ya) to B(xb,yb), as shown in Fig. 1. Without loss of generality, we suppose that the slope m of line L is in the interval [0, 1]. The intersection of L and a grid line x=xi is (xi,Y(xi)), where xi=xa+i, i=0,1,2,…,xb−xa, and Y(xi)=xa
Properties of BRDC
In this section, we study some important properties of BRDC. The first property is about the symmetry of BRDC. Property 1 Let H and k be two integers satisfying 0<k<H. If H is an odd integer, then Ak is symmetric, i.e. Proof Since H is odd, and , thenAccording to (3), there exists an integer m, such that Tk(i)=T−ik+mH. If Ak(i)=1, then 0⩽Tk(i)<k, i.e.Substituting T with H−1−T, we haveSo,Then Ak(H−1−i
Decomposition of BRDC
Properties 4 and 5 imply that the length of each repeated simple segment is N+1 or N+2. In order to study the distribution of the different lengths of the simple segments, segment code Sk is defined for the BRDC Ak as follows: If 0<k<H–k, thenOtherwise, 0<H–k<k, thenAccording to Property 3:the
Adaptive multi-pixel algorithm
In this section, we propose an adaptive multi-pixel line drawing algorithm as the application of Properties 3–5, and Lemma 2.
As shown in Fig. 1, the pixel approximation of line L1 and L2 can be divided into many simple segments: horizontal segments and catercorner segments. This can be analyzed by their BRDC. For a line in the first hexadecant, according to Property 4, the repeated simple segment in its BRDC starts with a jumping code followed by a number of 0’s. By the definition of BRDC, the
Conclusions and future works
We have presented an abstract representation called the BRDC, and studied some important properties of the BRDC, such as periodicity, symmetric, conjugate complementary, etc. These properties are very useful for designing and analyzing line drawing algorithms. Then we proposed a method to decompose a BRDC into a simpler one. At last, based on the above results, we have developed an efficient adaptive multi-pixel line drawing algorithm, which demonstrates the feasibility of BRDC.
Future work
Acknowledgements
The project is partly supported by the National Natural Science Funds of China for Excellent Young Scholars (Grant No: 69925204) and Innovative Research Groups (Grant No: 60021201) and for Research (Grant No: 60033010). The authors wish to thank the anonymous reviewers for their valuable comments.
References (17)
- et al.
Line rasterization algorithms that satisfy the subset line property
CVGIP
(1988) - et al.
Bi-directional incremental linear interpolation
Computer and Graphics
(1996) - et al.
Quadruple-step line generation
Computers and Graphics
(1989) - Tang Rongxi, Wang Jiaye, Peng Qunsheng. Computer graphics course. Beijing: Academic Press, 1990 [in...
Algorithm for computer control of a digital plotter
IBM System Journal
(1965)- Liu Yong-Kui.Generating,clipping of line and curve. Ph.D. thesis, Zhejiang University, Hangzhou Zhejiang, 1997 [in...
Computer processing of line drawing images
ACM Computing Surveys
(1974)- et al.
Fast line scan-conversion
ACM Transactions on Graphics
(1990)
Cited by (3)
Generalization of line drawing algorithm - An effective approach to minimize the error in the existing bresenham's line drawing algorithm
2021, 2021 International Conference on Emerging Smart Computing and Informatics, ESCI 2021Generation algorithm for cubic curves with double-step increment
2009, Proceedings of 2009 4th International Conference on Computer Science and Education, ICCSE 2009