15

Polygon CLipping

Embed Size (px)

DESCRIPTION

Polygon Clipping

Citation preview

Clipping Any procedure which identifes 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 fat shape consisting of straight lines that are joined to form a circuit. A polygon is traditionally a plane fgure that is bounded by a closed path, composed of a fnite sequence of straight line segments (i.e., by a closed polygonal chain. !hese segments are called its edges or sides, and the points where two edges meet are the polygon"s #ertices. !he interior of the polygon is sometimes called its body. The region against which an object is to be clipped is called clipping window.$lipping is required to specify a locali%ed #iew along with the con#enience and the fe&ibility of using a window ,because objects in the scene may be completely inside the window, completely outside the window, or partially #isible through the window. !he $lipping operation eliminates objects or portions of objects that are not #isible through the window to ensure the paper construction image.Polygon ClippingA 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. 'hat we really want to display is a bounded area after clipping. (or polygon clipping, we require an algorithm that will generate one or more closed areas that are then scan con#erted for the appropriate area fll. !he output of a polygon clipper should be a sequence of #ertices that defnes the clipped polygon boundaries. In )* graphics for e&ample, if the user of an image editing program is modifying an image and has +%oomed in+ the #iew to display only the top half of the image, there is no need for the program to spend any $,- time doing any of the calculations or memory mo#es needed to display the bottom half. .y clipping the bottom half of the image and a#oiding these calculations, the program runs faster.SutherlandHodgeman algorithmThe SutherlandHodgeman 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."utput is a new list of vertices.#ach edge goes through $ 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 vertexIf first both input vertices are inside& then just output second vertexIf first input vertex is inside& and second is outside& output is the intersectionIf both vertices are outside& output is nothingv'v(v)v'*v(v)+v'+v)*,ote% ,eed to consider each of $ edge boundariesoutsideinsidev'v'*v(outsideinsidev'v(outsideinsidev'v'*v(outsideinsidev'v("utside to inside%"utput% v'* and v(Inside to inside%"utput% v(Inside to outside%"utput% v'*"utside to outside%"utput% nothingv(v'v)-ight .lipper/ottom .lipperTop .lipper0eft .lipperv'v(v(v)v)v'v'*v(v(*v(*v)*v'v(v(*v(*v)*v)*v'v'v(v(*v)*v'v(v(v(*v(*v)*v)*v'v'v(v)*1igure 23(4& page ))(v(+v'*v(v(* v(*v(+v(+v'*v'*v(v(v(*v'*v(v(*v(+#dges"utput #dges "utput #dges "utput #dges "utput1inalWeiler- Atherton Polygon ClippingIn this algorithm,the #erte& /processing procedures for window boundaries are modifed so that conca#e polygons are displayed correctly. !his clipping procedure was de#eloped as a method for identifying #isible surfaces,and so it can be applied with arbitrary polygon0clipping 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 .5hich path we follow depend on the polygon3processing directionclockwise or counterclockwise! Sutherland3Hodgman5eiler36thertonImportance of clipping in video games7ood clipping strategy is important in the development of video games in order to maximi8e the game9s frame rate and visual :uality. ;espite 7 therefore& every optimi8ation of the graphics pipeline benefits the polygon budget and therefore the game. In video games& then& clipping is a critically important optimi8ation that speeds up the rendering of the current scene& and therefore allows the developer to increase the renderer9s polygon budget.