More info

Friday, 7 March 2014

Computer Graphics Notes - Lab 25 - 2D CLIPPING


The procedure that identifies the portions of a picture that are either inside or outside of a specified region of space is referred to as clipping. The region against which an object is to be clipped is called a clip window or clipping window. It is in a rectangular in shape.

The clipping algorithm determines which points, lines or portions of lines lay within the clipping window. These points, lines or portions of lines are retained for display. All others are discarded. We will consider algorithms for clipping the following primitive types
•    Point Clipping
•    Line Clipping
•    Polygon Clipping


Assuming that the clip window is a rectangle in standard position, we save a point P = (x, y) for display if the following inequalities are satisfied:
XWmin ≤ X ≤ XWmax
ywmin ≤ y ≤ ywmax
where the edge of the clip window (xwmin , xwmax, ywmin , ywmax) can be either the world-coordinate window boundaries or viewport boundaries. If any one of these four inequalities is not satisfied, the point is clipped (not saved for display).

Although point clipping is applied less often than line or polygon clipping, some application may require a point-clipping procedure.

Point Clipping


The lines are said to be interior to the clipping window and hence visible if both end points are interior to the window, e.g., line psp4 in the figure. However, if both end points of a line are exterior to the window, the line is not necessarily completely exterior to the window, e.g., line p7p8 in the figure. If both end points of a line are completely to the right of, completely to the left of, completely above, or completely below the window, then the line is completely exterior to the window and hence invisible, e.g., line p1p2 and p9p10 in the figure.
Line Clipping
Find the part of a line inside the clip window

The lines which across one or more clipping boundaries require calculation of multiple intersection points to decide the visible portion of them. To minimize the intersection calculations and to increase the efficiency of the clipping algorithm, initially, completely visible and invisible lines are identified and then intersection points are calculated for remaining lines.

Line Clipping
Find the part of a line inside the clip window

No comments:

Post a Comment