Software Engineering Requirements Engineering

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.
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 polygon.
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
Filling the polygon means highlighting all the pixels which
lie inside the polygon with any color other than background
 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.
Two difficulties with seed fill algorithms
1. 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
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
neighboring point.
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
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.
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.
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?

similar documents