•Clipping
 Any procedure which identifies that portion of a picture
  which is either inside or outside a picture is referred to
as a clipping algorithm or clipping.
In geometry a polygon is a flat shape consisting of straight
lines that are joined to form a circuit. A polygon is
traditionally a plane figure that is bounded by a closed
path, composed of a finite sequence of straight line
segments (i.e., by a closed polygonal chain). These
segments are called its edges or sides, and the points
where two edges meet are the polygon's vertices. The
interior of the polygon is sometimes called its body.
The region against which an object is to be
clipped is called clipping window.
Clipping is required to specify a localized view
along with the convenience and the flexibility of
using a window ,because objects in the scene may
be completely inside the window, completely
outside the window, or partially visible through
the window. The Clipping operation eliminates
objects or portions of objects that are not visible
through the window to ensure the paper
construction image.
•Polygon Clipping
A polygon boundary processed with a line clipper may be
displayed as a series of unconnected line segments,depending on
the orientation of the polygon to the clipping window. What we
really want to display is a bounded area after clipping. For
polygon clipping, we require an algorithm that will generate one
or more closed areas that are then scan converted for the
appropriate area fill. The output of a polygon clipper should be a
sequence of vertices that defines the clipped polygon
boundaries.
In 2D graphics for example, if the user of an image editing
program is modifying an image and has "zoomed in" the view to
display only the top half of the image, there is no need for the
program to spend any CPU time doing any of the calculations or
memory moves needed to display the bottom half. By clipping
the bottom half of the image and avoiding these calculations, the
program runs faster.
•Sutherland–Hodgeman algorithm
The Sutherland–Hodgeman algorithm is used for clipping
polygons. It works by extending each line of the convex clip
polygon in turn and selecting only vertices from the subject
polygon that are on the visible side
Input 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                                    v1


Outside to inside:    Inside to inside:   Inside to outside:        Outside to outside:
Output: v1’ and v2    Output: v2          Output: v1’               Output: nothing
v2’              v2                      Figure 6-27, page 332
v3


                      v1’
     v3’
                                  Left              Right              Bottom              Top
                 v1              Clipper            Clipper            Clipper            Clipper

                        v1v2     v2        v2v2’     v2’      v2’v3’    v2”      v2”v1’     v1’
                        v2v3     v2’       v2’v3’    v3’      v3’v1              v1’v2      v2
                        v3v1     v3’v1     v3’v1     v1       v1v2      v1’v2 v2v2’         v2’
                                           v1v2      v2       v2v2’     v2’      v2’v2”     v2”
                        Edges    Output    Edges    Output    Edges    Output    Edges     Output
                                                                                          Final
•Weiler- Atherton Polygon Clipping
In this algorithm,the vertex –processing procedures for window
boundaries are modified so that concave polygons are displayed
correctly. This clipping procedure was developed as a method for
identifying visible surfaces,and so it can be applied with arbitrary
polygon-clipping regions.
The basic idea in this algorithm is that instead of always
proceeding around the polygon edges as vertices are
processed,we sometimes want to follow the window
boundaries .Which path we follow depend on the polygon-
processing direction(clockwise or counterclockwise)
Sutherland-Hodgman




Weiler-Atherton
•Importance of clipping in video games
Good clipping strategy is important in the development of video
games in order to maximize the game's frame rate and visual
quality. Despite GPU chips that are faster every year, it remains
computationally expensive to transform, texture, and shade
polygons, especially with the multiple texture and shading passes
common today To maximize the game's visual quality,
developers prefer to establish the highest possible polygon
budget; therefore, every optimization of the graphics pipeline
benefits the polygon budget and therefore the game.

In video games, then, clipping is a critically important
optimization that speeds up the rendering of the current scene,
and therefore allows the developer to increase the renderer's
polygon budget.
Polygon clipping

Polygon clipping

  • 2.
    •Clipping Any procedurewhich identifies that portion of a picture which is either inside or outside a picture is referred to as a clipping algorithm or clipping. In geometry a polygon is a flat shape consisting of straight lines that are joined to form a circuit. A polygon is traditionally a plane figure that is bounded by a closed path, composed of a finite sequence of straight line segments (i.e., by a closed polygonal chain). These segments are called its edges or sides, and the points where two edges meet are the polygon's vertices. The interior of the polygon is sometimes called its body.
  • 3.
    The region againstwhich an object is to be clipped is called clipping window. Clipping is required to specify a localized view along with the convenience and the flexibility of using a window ,because objects in the scene may be completely inside the window, completely outside the window, or partially visible through the window. The Clipping operation eliminates objects or portions of objects that are not visible through the window to ensure the paper construction image.
  • 4.
    •Polygon Clipping A polygonboundary processed with a line clipper may be displayed as a series of unconnected line segments,depending on the orientation of the polygon to the clipping window. What we really want to display is a bounded area after clipping. For polygon clipping, we require an algorithm that will generate one or more closed areas that are then scan converted for the appropriate area fill. The output of a polygon clipper should be a sequence of vertices that defines the clipped polygon boundaries. In 2D graphics for example, if the user of an image editing program is modifying an image and has "zoomed in" the view to display only the top half of the image, there is no need for the program to spend any CPU time doing any of the calculations or memory moves needed to display the bottom half. By clipping the bottom half of the image and avoiding these calculations, the program runs faster.
  • 6.
    •Sutherland–Hodgeman algorithm The Sutherland–Hodgemanalgorithm is used for clipping polygons. It works by extending each line of the convex clip polygon in turn and selecting only vertices from the subject polygon that are on the visible side Input 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
  • 7.
    v1 v1’ v1” v3’ v3 v3” v2 v2 Note: Need to consider each of 4 edge boundaries
  • 8.
    outside inside outside inside outside inside outside inside v2 v2 v2 v2 v1’ v1’ v1 v1 v1 v1 Outside to inside: Inside to inside: Inside to outside: Outside to outside: Output: v1’ and v2 Output: v2 Output: v1’ Output: nothing
  • 9.
    v2’ v2 Figure 6-27, page 332 v3 v1’ v3’ Left Right Bottom Top v1 Clipper Clipper Clipper Clipper v1v2 v2 v2v2’ v2’ v2’v3’ v2” v2”v1’ v1’ v2v3 v2’ v2’v3’ v3’ v3’v1 v1’v2 v2 v3v1 v3’v1 v3’v1 v1 v1v2 v1’v2 v2v2’ v2’ v1v2 v2 v2v2’ v2’ v2’v2” v2” Edges Output Edges Output Edges Output Edges Output Final
  • 10.
    •Weiler- Atherton PolygonClipping In this algorithm,the vertex –processing procedures for window boundaries are modified so that concave polygons are displayed correctly. This clipping procedure was developed as a method for identifying visible surfaces,and so it can be applied with arbitrary polygon-clipping regions. The basic idea in this algorithm is that instead of always proceeding around the polygon edges as vertices are processed,we sometimes want to follow the window boundaries .Which path we follow depend on the polygon- processing direction(clockwise or counterclockwise)
  • 13.
  • 14.
    •Importance of clippingin video games Good clipping strategy is important in the development of video games in order to maximize the game's frame rate and visual quality. Despite GPU chips that are faster every year, it remains computationally expensive to transform, texture, and shade polygons, especially with the multiple texture and shading passes common today To maximize the game's visual quality, developers prefer to establish the highest possible polygon budget; therefore, every optimization of the graphics pipeline benefits the polygon budget and therefore the game. In video games, then, clipping is a critically important optimization that speeds up the rendering of the current scene, and therefore allows the developer to increase the renderer's polygon budget.