What is Polygon, edge and vertex?
A polygon is a closed figure composed of interconnected lines. A polygon is a shape with multiple sides that is represented by line segments. The line segments that constitute the polygon’s boundary are known as polygon edges, and the endpoints of the edges are known as polygon vertices.
Define the phrase “convex polygon.”
The angle between each consecutive pair of edges of a convex polygon is always less than 180o.
For a convex polygon, if we choose any two random points inside the polygon and connect them with a line, all of the points on the line are unquestionably inside the polygon.
Figure depicts examples of convex polygons.
Define the phrase “concave polygon.”
A concave polygon has an angle greater than 18o between at least one set of successive edges.
A concave polygon always has a pair of vertices inside it, and when joined by a line segment, part of the line segment falls outside the polygon.
Examples of concave polygons are illustrated in Figure.
What do you mean by complex polygon?
Complex polygons are polygons that are neither convex nor concave. Self-intersecting or overlapping polygons are complex polygons.
Examples of complicated polygons can be found in the following figure:
Describe and explain different polygon formats.
The graphics package determines how the polygon is represented in the system.
There are three techniques to representing the polygon:
- Polygon drawing primitive approach: Some graphics packages offer polygon as a fundamental image shape; in this case, the polygon is represented as a whole entity. Such polygons render quickly.
- Trapezoid primitive approach: In certain graphics programs, a polygon is approximated as a series of trapezoid primitives.
- Line and point approach: The polygon in this approach is defined by end point coordinates. To form the polygon, a line is generated between each end point.
Enlist advantages and disadvantages of Boundary fill algorithm
- Simple and easy to apply.
- Works with any sort of polygon.
- Due of recursion, substantial stacking is required.
- If the boundary is provided with various colors, it will not operate.
- It is necessary to indicate the seed point enclosed within the polygon.
- The background color should be used to fill the polygon.
- Uses a lot of stacking.
- Require more memory.
- Not suitable for the large polygon.
State pros and cons of Flood fill algorithm
- Easy to implement.
- The boundary fill method is incapable of handling objects with multi-color boundaries, whereas flood fill is.
- Extensive stacking is required.
- Slow in nature.
- Not suitable for large polygons
What is the difference between the Seed Fill and Scan Line Algorithms?
|Sr. No.||Seed fill algorithm||Scan line algorithm|
|1.||Simple to implement.||Very complex in nature.|
|2.||Operates in screen space.||Operates in screen and / or object space.|
|3.||Require system call to get pixel intensity .||It is device independent.|
|4.||Need to specify seed point contained within the polygon.||No need to specify seed point.|
|5.||Need extensive stacking.||No need of stacking.|
|6.||Generally used in graphics packages.||Typically used in interactive rendering.|
|7.||Not suitable for Z-Buffer.||Suitable for Z-Buffer.|
Scholarly Article: Generation of simple polygon from ordered points. Click to read.