•Clipping Any procedure which identifies that portion of a picture which is either inside or outside a picture is referred toas a clipping algorithm or clipping.In geometry a polygon is a flat shape consisting of straightlines that are joined to form a circuit. A polygon istraditionally a plane figure that is bounded by a closedpath, composed of a finite sequence of straight linesegments (i.e., by a closed polygonal chain). Thesesegments are called its edges or sides, and the pointswhere two edges meet are the polygons vertices. Theinterior of the polygon is sometimes called its body.
The region against which an object is to beclipped is called clipping window.Clipping is required to specify a localized viewalong with the convenience and the flexibility ofusing a window ,because objects in the scene maybe completely inside the window, completelyoutside the window, or partially visible throughthe window. The Clipping operation eliminatesobjects or portions of objects that are not visiblethrough the window to ensure the paperconstruction image.
•Polygon ClippingA polygon boundary processed with a line clipper may bedisplayed as a series of unconnected line segments,depending onthe orientation of the polygon to the clipping window. What wereally want to display is a bounded area after clipping. Forpolygon clipping, we require an algorithm that will generate oneor more closed areas that are then scan converted for theappropriate area fill. The output of a polygon clipper should be asequence of vertices that defines the clipped polygonboundaries.In 2D graphics for example, if the user of an image editingprogram is modifying an image and has "zoomed in" the view todisplay only the top half of the image, there is no need for theprogram to spend any CPU time doing any of the calculations ormemory moves needed to display the bottom half. By clippingthe bottom half of the image and avoiding these calculations, theprogram runs faster.
•Sutherland–Hodgeman algorithmThe Sutherland–Hodgeman algorithm is used for clippingpolygons. It works by extending each line of the convex clippolygon in turn and selecting only vertices from the subjectpolygon that are on the visible sideInput each edge (vertex pair) successively.Output is a new list of vertices.Each edge goes through 4 clippers.The rule for each edge for each clipper is: If first input vertex is outside, and second is inside, output the intersection and the second vertex If first both input vertices are inside, then just output second vertex If first input vertex is inside, and second is outside, output is the intersection If both vertices are outside, output is nothing
v1 v1’ v1” v3’ v3 v3” v2 v2 Note: Need to consider each of 4 edge boundaries
outside inside outside inside outside inside outside inside v2 v2 v2 v2 v1’ v1’ v1 v1 v1 v1Outside to inside: Inside to inside: Inside to outside: Outside to outside:Output: v1’ and v2 Output: v2 Output: v1’ Output: nothing
•Weiler- Atherton Polygon ClippingIn this algorithm,the vertex –processing procedures for windowboundaries are modified so that concave polygons are displayedcorrectly. This clipping procedure was developed as a method foridentifying visible surfaces,and so it can be applied with arbitrarypolygon-clipping regions.The basic idea in this algorithm is that instead of alwaysproceeding around the polygon edges as vertices areprocessed,we sometimes want to follow the windowboundaries .Which path we follow depend on the polygon-processing direction(clockwise or counterclockwise)
•Importance of clipping in video gamesGood clipping strategy is important in the development of videogames in order to maximize the games frame rate and visualquality. Despite GPU chips that are faster every year, it remainscomputationally expensive to transform, texture, and shadepolygons, especially with the multiple texture and shading passescommon today To maximize the games visual quality,developers prefer to establish the highest possible polygonbudget; therefore, every optimization of the graphics pipelinebenefits the polygon budget and therefore the game.In video games, then, clipping is a critically importantoptimization that speeds up the rendering of the current scene,and therefore allows the developer to increase the rendererspolygon budget.