Abstract

This chapter describes a simple, efficient polygon scan-conversion algorithm that allows a mesh of polygons to be scan-converted, one polygon at a time, without drawing any pixel twice and without leaving any holes. The algorithm uses a slightly modified Bresenham algorithm to scan-convert the polygon edges and uses half-open intervals to disambiguate the pixels lying on edges shared by adjacent polygons. The chapter presents a scan-line algorithm for triangles; however, the technique is readily extended to arbitrary simple polygons. A scan conversion algorithm that paints pixels whose centers are mapped to a given polygon P will be able to render all the polygons of a polygonal mesh, one at a time, without leaving any holes or duplicating any pixels. For efficiency, EdgeScan is computed incrementally using a Bresenham-like algorithm. The EdgeSetup routine initializes a structure that contains the increments, and the EdgeScan routine uses those increments to compute the intersection of the edge with each scan line. A necessary consequence of painting only those pixels whose centers map to a polygon is that the algorithm may draw disconnected sets of pixels for very thin polygons and draws no pixels at all for polygons that are degenerate—such as line segments or single points.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.