The following are the Pages-96 and Page-97 of the book Schaum's outline series of Computer Graphics.
The algorithm considers several things:
(1) Whether the polygon is Convex or Concave.
(2) Whether the polygon is positively or negatively oriented.
(3) And, finally, testing polygon edges against the edges of the clipping window.
Consider the WXYZ
as the clipping rectangle in the following picture.
I have several questions:
(1) Do I need to test an edge AB
against all of the edges of wxyz
or just wx
?
(2) Suppose, I test AB
against wx
. According to the Page-97 of the book, I should be testing whether it is on the left or on the right side of the clipping edge. But,in this case, there are no lefts or rights. There are aboves and bellows. How can I determine whether it is inside or outside?
(3) How can I keep track of the Inside
and Outside
? For example, Consider the polygon edge BC
. If I test it against ZW
, it is on the Right side and Inside the Clipping Region. If I test it against YX
, it is on the Left side and Inside the Clipping Region. It turns out to me that, it is actually not possible to find the position of a point with respect to the clipping region unless we consider the region at once and as a whole. Then why is the book testing points against one line at a time?
(4) Consider the edge DE
. Is it going out or coming in?