1 / 11

Scan Conversion, Polygons

Scan Conversion, Polygons. Dr. Aree Ali Mohammed Assistant Professor 2013-2014 3 rd Stage aree.ali@univsul.net. What is polygon?.

lucus
Download Presentation

Scan Conversion, Polygons

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Scan Conversion,Polygons Dr. Aree Ali Mohammed Assistant Professor 2013-2014 3rd Stage aree.ali@univsul.net University of Sulaimani - School of Science - Computer Dept.

  2. What is polygon? • A polyline is a chain of connected line segments. When starting point and terminal point of any polyline is same, i.e. when polyline is closed then it is called polygon.

  3. Polygon Types • The classification of polygons is based on where the line segment joining any two points within the polygon is going to lie. • Convex : is a polygon in which the line segment joining any two points within the polygon lies completely inside the polygon. • Concave: is a polygon in which the line segment joining any two points within the polygon may not lie completely inside the polygone. University of Sulaimani - School of Science - Computer Dept.

  4. Representation of Polygons • To add polygon to a graphic system, we must first decide how to represent it. There are three approaches: • Polygon drawing primitive approach 2. Trapezoid primitive approach 3. Line and point Most of the graphic devices do not provide any polygon support at all. In such cases polygons are represented using lines and points.  Display file University of Sulaimani - School of Science - Computer Dept.

  5. Enter Polygon into Display File • Enter number of sides and the coordinate of the vertex points. University of Sulaimani - School of Science - Computer Dept.

  6. Polygon Filling • Filling the polygon means highlighting all the pixels which lie inside the polygon with any color other than background color. • Seed Fill : point known to be inside the polygon and highlight the outward from this point i.e., neighboring pixels until we encounter the boundary pixels. • Boundary fill algorithm and flood fill algorithms • Scan – line algorithm fill : Avoid seed point but it is costly !!!! • It checks whether pixels inside or outside the polygon. University of Sulaimani - School of Science - Computer Dept.

  7. Scan Line Algorithm Two difficulties with seed fill algorithms • If some inside pixels are already displayed in fill color then recursive branch terminates, leaving further internal pixels unfilled. Solution: change the color of any internal pixels that are initially set to the fill color before applying seed fill procedure. 2. It can not used for large polygons. Solution: more efficient method can be used.. Such method fills horizontal pixel spans across scan lines, instead of proceeding to 4-connected or 8- connected neighbouring point. University of Sulaimani - School of Science - Computer Dept.

  8. Scan Line Conversion for Polygon Filling • Begins with the largest y value and scans down the polygon. For each y, it determines which sides can be intersected and finds the x values of these intersection points. It then sorted, pairs and passes these x values to a line drawing routine. University of Sulaimani - School of Science - Computer Dept.

  9. Scan Conversion I • Real Time Scan Conversion The picture is randomly represented in terms of visual attributes and geometric properties. The color, shade and intensity (attributes), (x,y), slope and text (geometric) Advantages: less memory, easy update the list, dynamic picture representation Disadvantages: Complexity of the picture is limited by speed of the display processor. University of Sulaimani - School of Science - Computer Dept.

  10. Scan Conversion II 2. Run Length Encoding In many pictures, we observe that a large number of pixels in the picture have the same intensity or color. Advantages: picture is stored in compressed form 10:1, less memory, saves storage for animated sequences and films Disadvantages: since RLE is sequential, update is difficult and for short runs, expansion may result instead of compression. University of Sulaimani - School of Science - Computer Dept.

  11. Review Questions • What is polygon? Explain different types of polygons. • Explain various approaches to represent polygons. • Explain the polygon entering algorithm in the display file. • Discuss the merits and demerits of real time scan conversion and RLE. • For large polygons the flood fill algorithm may fail, why? What could be the method to avoid this? University of Sulaimani - School of Science - Computer Dept.

More Related