1.
Clipping Any Procedure that identifies those portions of a picture that are either inside or outside of a specified region of a space is referred to as a Clipping algorithm or simply Clipping . The region against which an object is to clipped is called a Clip Window.
2.
Clipping * Clipping algorithms are 2D-3D. * Clipping algorithm can be implemented in hardware or software. * When implemented in software, clipping algorithms are slower than required for real time applications. * For this reason both 2D & 3D clipping algorithm have been implemented in hardware or firmware. * The purpose of a clipping algorithm is to determine which points, lines or portions of lines lie with in the clipping window. * These points, lines or portions of lines are relative for display. * All other are discarded.
3.
* Application of clipping include extracting part of a defined scene for viewing. * Identifying visible surface in 3D views. * Antiliasing line segment or object boundaries. * Creating objects using solid-modeling procedures. * Displaying a multi window environment. * Drawing & painting operation that allow part of a picture to be selected for clipping, moving, erasing or duplicating.
* Depending on the application, the clip window can be a general polygon or it can even have curved boundaries. * For the viewing transformation, we want to display only those picture parts that are within the window area. Everything outside the window is discarded. * Clipping algorithm can be applied in World Coordinates, so that only the contents of the window interior are mapped to Device coordinates.
* A line clipping procedure involves several parts.
* In many cases the large majority of points or lines are either interior or exterior to the clipping window.
* Therefore it is important to be able to quickly accept a line which is completely interior to the window & reject a line which is exterior to the window.
8.
Line Clipping * Lines are interior to the clipping window & hence visible if both end points are interior to the window. * Points are interior to the clipping window provided that XL <= X <= XR YB <= Y <= YT
9.
I J G H E F A B C D K L Right Bottom Top Left Line Clipping
10.
Line Clipping * However, if both endpoints of a line are exterior to the window, the line is not necessarily completely exterior to the window. * If both end points of a lines are:-
# completely to the right of the window. # completely to the left of the window. # completely above the window. # completely bottom the window.
Then the line is completely exterior to the window & hence invisible
The tests for totally visible lines and the region tests for totally invisible lines can be formalized using a technique i.e. Cohen & Sutherland Algorithm.
The technique uses a four digit (bit) code, known as “Region Code”, to indicate which of nine regions contains the end points of a line.
12.
Cohen & Sutherland Algorithm The rightmost bit is the first bit. The bits are set to 1 based on the following scheme. 1) First bit Set- If the end point is to the left of the window. 2) Second bit Set- If the end point is to the right of the window. 3) Third bit Set- If the end point is to the below the window. 4) Fourth bit Set- If the end point is to the above the window. Otherwise the bit is set to Zero. It is obvious that, if both end point codes are zero, then both ends of the line lie inside the window & the line is visible.
Lines that can not be identified as completely inside or completely outside a clip window by there tests are checked for intersection with the window boundaries.
Such lines may or may not cross into the window interior.
We begin the clipping process for a line by comparing an outside endpoint to a clipping boundary to determine how much of line can be discarded.
Then the remaining part of the line is checked against the other boundaries, and we continue until either the line is totally discarded or a section is found inside the window.
We set up our algorithm to check line end point against clipping boundaries in the order left, right, bottom, & top.
Lines which can not be immediately identified using there test are subdivided into 2 equal parts.
The test are then applied to each half until the intersection with the window edge is found or the length of the divided segment is infinitesimal i.e. 0 point.
The visibility of the point is then determined.
The result is to perform a logarithmic search for the intersection point.
Be the first to comment