Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.



Published on

  • Be the first to comment


  1. 1. ClippingProcedure that identifies those portions of a picture that are either inside or outside a specified region of space is referred to as a clipping algorithm, or clipping. A region against which a object is to clipped is called a clip window. Application of clipping includes extracting a portion of a scene, drawing and painting operations.In clipping only those elements will be displayed which comes inside the window.
  2. 2. Everything outside the window is discarded.Sheilding: Determines those elements of the picture which will not be displayed.Clipping is basically of following types:-1.) Point Clipping2.) Line Clipping3.) Polygon Clipping4.) Curve Clipping5.) Text Clipping
  3. 3. Point ClippingAssuming that the clip window is a rectanglein standard position, we save a point P = (x,y)for display if the following inequalities aresatisfied: xwmin < x < xwmax ywmin < y < ywmaxwhere the edges of the clip window(xwmin,xwmax, xymin, xymax) can be either the world-coordinate window boundaries or viewportboundaries.
  4. 4. If any one of these four inequalities is notsatisfied, the point is clipped( not saved fordisplay).Point clipping can be applied to scenes involving explosions or sea foam that are modeled with particles (points) distributed in some region of the scene.
  5. 5. Line ClippingA Clipping line procedure involves two parts:1.)If we cannot identify a line as completely inside or outside the clipping window then we must perform calculation of those lines which intersect the clipping window.2.) Then we start clipping.We process lines by checking their endpoints& test which points of the lines comes insideor outside the clip window.
  6. 6. P6 P2 P8 P1 P4P5P3 Before Clipping P7 Clipping Window P2 P1 P4 P8’ P3’ P7’ After Clipping
  7. 7. In Line Clipping some lines may be invisible some may be visible & some may be partially visible.Line P1P2 is visible b’coz both endpoints comes inside the clipping window.Line P5P6 is invisible b’coz there endpoints are completely exterior to the window.Line P3P4 & P7P8 are partially visible lines.
  8. 8. COHEN- SUTHERLAND ALGORITHMSteps for finding out the clipping of lines are:1.) We use 4-bit code for every endpoint of the line. Bits are set to 1 depending upon the following conditions: 1st bit (left most bit)- will set to 1 if end point is above the top edge of window. 2nd bit – set to 1 if endpoint is below the bottom edge of the window. 3rd bit – set to 1 if endpoint is to the right of the right edge of the window.
  9. 9. 4th bit – set to 1 if endpoint is to the left ofthe left edge of the window.Left Edge Top Edge 1001 1000 1010 Clip Window 0010 0001 0000 0101 0100 0110 Right EdgeBottom Edge
  10. 10. P6 P2 P8 P1 P4P5 P3 P7
  11. 11. 2.) Using coding scheme we can say that:Line EP1 EP2 Logical Results ANDP1P2 0000 0000 0000 Totally visibleP3P4 0001 0000 0000 Partially visibleP5P6 0001 0001 0001 Totally invisibleP7P8 0000 0000 0000 Totally visible3.) After selecting those lines which are partially visible, we determine those points
  12. 12. of the line which intersect with the Clippingwindow boundaries. Then we subdivide theintersection points into various smaller linesegments in visible & not visible categories.The line segment which comes under visiblecategory will be clipped.4.) Using the bit values of the endpoints ofintersecting lines we choose those endpointsof segments which have no intersecting
  13. 13. Bit value (any bit value should not be 1) i.ewhich have bit values equivalent to theboundary of Clipping window(0000).MIDPOINT SUBDIVISION ALGORIT:-For Clipping any Partially visible line we usethis algorithm. It is based on the bisectionmethod.The line is divided at its midpoint intotwo shorter line segments using the endpointvalues.
  14. 14. The midpoint coordinates (xm, ym) of aline joining (x1,y1) & (x2,y2) are given by xm = x1 + x2 ym = y1 + y2 2 2