ComputerGraphics CS602 1 SOL - Do
ComputerGraphics CS602 1 SOL - Do
Instructions
Please read the following instructions carefully before submitting assignment: It should be clear that your assignment will not get any credit if: The assignment is submitted after due date. The submitted assignment does not open or file is corrupt. The assignment is copied or any sort of cheating found. Student ID is not mentioned properly in the assignment File.
Note: For any query about the assignment, contact at [email protected]
Question 1 10 marks What are the problems lying in odd parity method and how even parity can be used in advantage for filling polygon? Solution
The odd parity method creates a problem: How do we determine whether a pixel lies outside of the polygon to test for an inside one, if we cannot determine whether one lies within or outside of the polygon in the first place? If we assume our polygon lies entirely within our scene, then the edge of our drawing surface lies outside of the polygon. Furthermore, it would not be very efficient to check each point on our drawing surface to see if it lies within the polygon and, therefore, needs to be colored. So, we can take advantage of the fact that for each scan-line we begin with even parity; we have NOT crossed any polygon edges yet. Then as we go from left to right across our scan line, we will continue to have even parity (i.e., will not use the fill color) until we cross the first polygon edge. Now our parity has changed to odd and we will start using the fill color. How long will we continue to use the fill color? Well, our parity won't change until we cross the next edge. Therefore, we want to color all of the pixels from when we crossed the first edge until we cross the next one. Then the parity will become even again. So, you can see if we have a sorted list of x-intersections of all of the polygon edges
with the scan line, we can simply draw from the first x to the second, the third to the forth and so on.
Question 2 10 marks Using the scan line polygon filling algorithm, find "All edge table" and "Global edge table" for following figure.
Solution
1. All edge table
Deadline: