Path: utzoo!attcan!utgpu!watmath!watcgl!ksbooth From: ksbooth@watcgl.waterloo.edu (Kelly Booth) Newsgroups: comp.graphics Subject: Re: clipping polygons to a viewport Keywords: polygons,clipping Message-ID: <11755@watcgl.waterloo.edu> Date: 4 Oct 89 00:46:43 GMT References: <120@csinc.UUCP> Reply-To: ksbooth@watcgl.waterloo.edu (Kelly Booth) Organization: U. of Waterloo, Ontario Lines: 17 In article <120@csinc.UUCP> shal@csinc.UUCP (Shal Jain x848) writes: >Am looking for a very robust algorithm/code for clipping polygons to a >rectangular viewport. Foley and Van Dam's text also discusses this problem. The classic paper is Ivan E. Sutherland & Gary W. Hodgman Reentrant Polygon Clipping Communications of the ACM Vol 7 No 1 (January 1974) pp. 32-42 Beware: There is one error in a diagram (a flowchart, I think) in the paper. The appendix to the paper discusses the particular problem you pose (a concave polygone which, after clipping, results in two or more disconnected polygonal regions). The solution requires sorting the points of intersection along each edge of the clipping window/viewport to discover the various pieces.