 Hello friends, myself Darshan Pandit, Assistant Professor, Department of Computer Science and Engineering from Walton Institute of Technology, Solapur. So, today we are going to discuss about Sutherland Cohen Line Clipping Algorithm. So, at the end of the session student will be able to perform clipping against the window edges. So, in this session we are going to see about clipping viewport and window. So, clipping is the procedure that identifies the portion of a picture that are either inside or outside of a specified region of space and world coordinate window is the area of interest that is what the user want to visualize in some application specific coordinate and viewport is an area typically rectangular expressed in rendering device specific coordinate that is pixels for screen coordinate in which the object of interest are going to be rendered. That is viewport is nothing but the screen coordinate and in world coordinate we are selecting the part of the picture that is to be visualized on the screen coordinate and this visualization is done on viewport that is on your screen coordinate. So, in this example we can see so these are the picture in world coordinate and some part of picture is clipped which is known as clipping window and this clipping window is mapped to the viewport that is to your display device. So, this much part of the picture is displayed on your display device so that is nothing but your viewport coordinate. So here window is the process of selecting and viewing the picture with different views and clipping window is the region against which object is clipped. So, here you can see the so you can see the star and in next picture the star is zoomed to the window after that some part of star is going outside the clipping window and that much part is clipped or cropped against the window and remaining part is displayed on your screen so that is nothing but the clipping process. So, with this example we are going to see how to clip the line segment to this window edges ok and also we need to determine which line segment are inside and which line segment are completely outside the window. So, this can be done with the help of inside visibility test where we divide the view plane into 9 regions and we assign each region a 4 bit region code. So, these are the region code 0 0 0 0 0 0 1 0 so in this way we assign region code for all 9 region after that so the line segment will get the region code that is end point of the line segment will get region code and if x less than x mean then we can say that line segment is to the left of the window and if x greater than x max then we can say end point of the line segment is to the right of the window and if y less than y mean then we can say end point of line segment is lying at bottom of the window and if y greater than y max then we can say end point of line segment is lying to the top of the window. So, in this way we can identify where the line segment is lying that is either it is partially inside or partially outside. So, this can be identified with the help of this region code. So, let us consider the previous example. So, now first we will see for line p 1 p 2 so this is the window and these are the line segment we are adding dividing this window in 9 regions and adding region code for it. So, now each line segment is having one region code and we need to perform and operation of this region code and we need to check this condition like if region code of both end point are 0 then line is completely visible and if region code for both end point are not 0 and logical ending of them is also non-zero then the line is completely invisible. So, we can reject the line after that if region code for two end point do not satisfy above two conditions then line is partially visible. So, here we can see for line p 1 p 2 so p 1 is having region code 0 0 0 1 and p 2 is having 0 1 0 0. So, and operation of this two end point gives you 0 0 0 0. So, we can say that line is partially visible same for line p 3 p 4 so p 3 is having and region code 0 0 0 0 and p 4 is having 0 0 1 0. So, and operation of p 3 p 4 gives 0 0 0 0 hence we can say line is partially visible. Partially visible is nothing but some part of line segment is inside the clipping window. Next for the line p 5 p 6 so p 6 is having 0 0 0 0 and p 5 region code is 0 1 1 0. So, and operation of both end point gives you 0 0 1 0. So, here we can say that line is completely invisible because ending of both the end point is not 0 0 0 0. So, there is a 1 in the bit position so we can say line is completely invisible and we can reject the line. Next line segment is p 7 p 8 and both the end point is having region code 0 0 0 0. So, and operation of both end point gives you 0 0 0 0. So, we can say that line is completely visible. So, in this way we need to generate the table for the line segment p 1 p 2 p 3 p 4 p 5 p 6 and p 7 p 8 which tells us the line is partially inside or completely outside or completely inside with the help of and operation of two end point. So, after forming this table now we can apply clipping process on partially visible lines. So, with the help of slope intercept we can calculate intersection of line segment with the window edges. So, after calculating window edges so these are the two new points we get p 1 dash and p 2 dash p 3 and p 4 dash. So, on this we need to apply slope intercept for calculation of intersection of window and line segment. So, here for line p 1 p 2 so this is the intersection point. So, this is calculated with the help of slope intercept and we need to clip this line segment and same for p 3 p 4. So, here we need to calculate this intersection point with the help of slope intercept and after that we get p 1 dash and p 2 dash and p 3 and p 4 dash. So, these are the result after clipping that is p 1 dash p 2 dash p 3 p 4 dash and p 5 p 7. So, here you can pause the video and answer the question. So, here you need to apply so the line coin algorithm and clip the window edges. So, these are the two line segment a 1 a 2 a 3 a 4 you need to clip this line segment to the window. So, in this way you need to generate the table which shows inside visibility test for line a 1 a 2 and a 3 a 4 after that you need to generate the result of the clipping. So, these are the references which I have used to create this video. Thank you.