Please wait a minute...
Journal of Zhejiang University-SCIENCE A (Applied Physics & Engineering)  0, Vol. 6 Issue (100): 100-107    DOI: 10.1631/jzus.2005.AS0100
Computer & Information Science     
Line clipping against polygonal window algorithm based on the multiple virtual boxes rejecting
WANG Jin, LU Guo-dong, PENG Qun-sheng, WU Xuan-hui
State Key Lab. of CAD&CG, Zhejiang University, Hangzhou 310027, China; Department of Electrical and Computer Engineering, National University of Singapore, 117576, Singapore
Download:   PDF(0KB)
Export: BibTeX | EndNote (RIS)      

Abstract  This paper presents a new algorithm for line clipping against a polygonal window by exploiting the local relationship between each line segment and the polygon. Firstly, a minimal enclosing box (MEB) of the polygon is adopted to reject the invisible line segments located outside the MEB. Secondly, a 45° rotated box is used to encode the endpoint of the line segment, and then reject a portion of the invisible segments crossing polygon corners. Finally, instead of encoding the endpoints of all line segments with respect to the polygonal window, each vertex of the polygon is encoded, taking the line segment to be clipped as reference. For efficient encoding of the polygon vertices, a new concept, termed with slope adaptive virtual box, is introduced regarding each line segment. Such a box can not only conveniently reject all totally invisible lines lying outside the MEB conveniently, but also precisely identify the edges of the polygon with which the line segment potentially intersects. With the summation of the vertex codes, it can be verified whether the line segment is separated from or potentially intersects the polygon window. Based on the product of the codes of adjacent vertices, singular cases of intersection can be solved accurately. Experimental results demonstrate the efficiency and stability of the new algorithm.

Key wordsPolygon vertex encoding      Adaptive virtual box      Line segment rejection      Line segment intersection      Line clipping     
Received: 10 February 2005     
CLC:  TP312  
Cite this article:

WANG Jin, LU Guo-dong, PENG Qun-sheng, WU Xuan-hui. Line clipping against polygonal window algorithm based on the multiple virtual boxes rejecting. Journal of Zhejiang University-SCIENCE A (Applied Physics & Engineering), 0, 6(100): 100-107.

URL:

http://www.zjujournals.com/xueshu/zjus-a/10.1631/jzus.2005.AS0100     OR     http://www.zjujournals.com/xueshu/zjus-a/Y0/V6/I100/100

[1]   Bui, D.H., Skala, V., 1999. New Fast Line Clipping Algorithm in E2 with O(lgN) Complexity. International Conferences SCCG
[2]   Cyrus, M., Beck, J., 1978. Generalized two and three dimensional clipping. Computers & Graphics, 3(1):23-28.
[3]   Liang, Y.D., Barsky, B.A., 1984. A new concept and method for line clipping. ACM Trans. Graphics, 3(1):1-22.
[4]   Liu, Y.K., Liu, G.F., 1993. Line clipping against generalized polygon. Journal of Computer-Aided Design & Computer Graphics, 5(4):269-274 (in Chinese).
[5]   Liu, Y.K., Yan, Y., Shi, J.Y., 1999. An efficient algorithm for the line clipping against a polygon. Chinese Journal of Computers, 22(11):1210-1214 (in Chinese).
[6]   Lu, G.D., Wu, X.H., 2002. Midpoint-subdivision line clipping algorithm based on filtering technique. Computer-Aided Design & Computer Graphics, 14(6): 513-517 (in Chinese).
[7]   Lu, G.D., Wu, X.H., Peng, Q.S., 2002. An efficient line clipping algorithm based on adaptive line rejection. Computers & Graphics, 3(26):409-415.
[8]   Newman, W.M., Sproull, R.F., 1979. Principles of Interactive Computer Graphics. McGraw-Hill, New York.
[9]   Nicholl, T.M., Lee, D.T., Nicholl, R.A., 1987. An efficient new algorithm for 2D line clipping: Its development and analysis. Computer Graphics, 21(4):253-262.
[10]   Skala, V., 1993. Efficient algorithm for line clipping by convex polygon. Computers & Graphics, 17(4):417-421.
[11]   Sproull, R.F., Southerland, I.E., 1968. A Clipping Divider. Proceedings of the Fall Joint Computer Conference, 33:765-776.
[12]   Wang, J., Liang, Y.D., Peng, Q.S., 1991. A 2-D line clipping algorithm with least arithmetic operations. Chinese Journal of Computers, 14(7):495-504 (in Chinese).
[1] Bao-jun ZHANG, Xue-zeng PAN, Jie-bing WANG, Ling-di PING. A recoverable stress testing algorithm for compression and encryption cards[J]. Journal of Zhejiang University-SCIENCE A (Applied Physics & Engineering), 2008, 9(10): 1398-1405.
[2] WANG Jin, LU Guo-dong, PENG Qun-sheng, WU Xuan-hui. Line clipping against polygonal window algorithm based on the multiple virtual boxes rejecting[J]. Journal of Zhejiang University-SCIENCE A (Applied Physics & Engineering), 2005, 6(Supplement1): 100-107.