What do you mean by Polygon Clipping?
Polygon Clipping:-
polygon clipping to clip polygons one needs to modify the line clipping procedure. a polygon boundary processing with a line clipper may be displayed as a series of unconnected line segments depending on the
orientation of the polygon to clipping window. A bounded area is displayed after clipping as in figure .for polygon clipping an algorithm is required that will generate one or more closed areas that are than scan converted for the appropriate area fill. The output of a polygon clipper should be sequence of vertices's that define the clipped polygon boundaries.
orientation of the polygon to clipping window. A bounded area is displayed after clipping as in figure .for polygon clipping an algorithm is required that will generate one or more closed areas that are than scan converted for the appropriate area fill. The output of a polygon clipper should be sequence of vertices's that define the clipped polygon boundaries.
Sutherland- Hodgeman Polygon Clipping:-
Sutherland- hodgeman polygon clipping using this method of clipping each edge of the viewport is compared with the respect of the each vertices of the polygon turn.in a general way the polygon is the first check with the left boundary and if necessary, clipping is done. after that right side checking and clipping is done. lastly checking and clipping from the bottom and top side are done to get the complete clipped polygon and show in the given figure.
so, after clipping the polygon from the left boundary edge is a set of vertices are obtained to get the clipped image of the polygon from the left hand side. after that, newly figure polygon is passed for further clipping from the right hand side.in the same way it will be further produce a set of vertex. In the same way it will be further passed for clipping from the bottom side and upper side of the view port .
To process for clipping using the above sequence 4 types of condition appear. To illustrate this, let us consider a polygon having the vertex P1 P2 p3 and P4 are placed in given view port as shown in the figure.
case 1. If the first vertex is at outside of the view port and second vertex is inside as the show in the figure.
In this case the vertex P1 is placed outside and P2 is placed at the inside area of the view port to get that clipped image, both the interaction point of the polygon edges with the window boundary and second vertex is stored in the vertex list. so, initially the vertex list was P1 -P2- P3- P4 and after clipping on this condition the vertex list will be changed as the P1' P2 P3 P4.
case 2. if both the vertex are inside of the view port here as shown in the figure the vertex P2 and P3 of the polygon is placed in the view port completely. so, P2 and P3 will remain in the vortex list so this time the list will be remain unchanged and will remain to P1' P2 P3 P4.
case 3. if the first vertex is inside of the view port and the second vertex is at the outside of the view port.
This situation Happens For The edge P3 P4 of the polygon show in the figure .here in the same way as in case one. a new point P 4' is to be find out which will be obtained from the crossing of the view port boundary line and the P3 P4 edges of the polygon. so in this case the old vertex list will have to be changed and will be : P1' p2 p3 p4'.
case 4. if both the vertices are found to be at the outside of the view port this situation happened here the in the case of P4 P1 edges of the polygon ..in this case the complete edges is to be removed and thus no change of the vertexs list will take place.
so for the given polygon and view port the original vertex list P1 P2 P3 P4 will have to be changed to P1' p2 P3 P4 to the complete clipped image of given polygon.
To implement this algorithm one will accept the coordinates of the vertex of the polygon and will store in a vertex list. the list may be an array as well. after that the pair of vertices passed sequentially, to find the satisfied condition of the above given for possibilities. after that changed the list of vertex, if required and in that case clipped will be done.
algorithm Sutherland-Hodgeman polygon clipping
step 1 P is the input polygon array.
step 2 Q is the output polygon array .
step 3 W is the clipping window array; the first vertex is repeated as the last vertex.
step 4 Nin is the number of input polygon vertex
step5 Nout is the number of output polygon vertex
step6 NW is the number of clipping polygon vertex plus one all polygon vertex are given in the counter clockwise order
Computer Graphics Notes
so, after clipping the polygon from the left boundary edge is a set of vertices are obtained to get the clipped image of the polygon from the left hand side. after that, newly figure polygon is passed for further clipping from the right hand side.in the same way it will be further produce a set of vertex. In the same way it will be further passed for clipping from the bottom side and upper side of the view port .
To process for clipping using the above sequence 4 types of condition appear. To illustrate this, let us consider a polygon having the vertex P1 P2 p3 and P4 are placed in given view port as shown in the figure.
case 1. If the first vertex is at outside of the view port and second vertex is inside as the show in the figure.
In this case the vertex P1 is placed outside and P2 is placed at the inside area of the view port to get that clipped image, both the interaction point of the polygon edges with the window boundary and second vertex is stored in the vertex list. so, initially the vertex list was P1 -P2- P3- P4 and after clipping on this condition the vertex list will be changed as the P1' P2 P3 P4.
case 2. if both the vertex are inside of the view port here as shown in the figure the vertex P2 and P3 of the polygon is placed in the view port completely. so, P2 and P3 will remain in the vortex list so this time the list will be remain unchanged and will remain to P1' P2 P3 P4.
case 3. if the first vertex is inside of the view port and the second vertex is at the outside of the view port.
This situation Happens For The edge P3 P4 of the polygon show in the figure .here in the same way as in case one. a new point P 4' is to be find out which will be obtained from the crossing of the view port boundary line and the P3 P4 edges of the polygon. so in this case the old vertex list will have to be changed and will be : P1' p2 p3 p4'.
case 4. if both the vertices are found to be at the outside of the view port this situation happened here the in the case of P4 P1 edges of the polygon ..in this case the complete edges is to be removed and thus no change of the vertexs list will take place.
so for the given polygon and view port the original vertex list P1 P2 P3 P4 will have to be changed to P1' p2 P3 P4 to the complete clipped image of given polygon.
To implement this algorithm one will accept the coordinates of the vertex of the polygon and will store in a vertex list. the list may be an array as well. after that the pair of vertices passed sequentially, to find the satisfied condition of the above given for possibilities. after that changed the list of vertex, if required and in that case clipped will be done.
algorithm Sutherland-Hodgeman polygon clipping
step 1 P is the input polygon array.
step 2 Q is the output polygon array .
step 3 W is the clipping window array; the first vertex is repeated as the last vertex.
step 4 Nin is the number of input polygon vertex
step5 Nout is the number of output polygon vertex
step6 NW is the number of clipping polygon vertex plus one all polygon vertex are given in the counter clockwise order
Computer Graphics Notes




EmoticonEmoticon