If you do not want to plot all the pixels in the image, then you have to specify which part of the images you do not require to the computer. So in order to accomplish this task, we make a region, and this region is also known as a clip window and everything outside the region of this window will not be plotted. This clip window can be in any shape and size and the part of the image in this clipping window is only plotted and also we can shift the position of the clipping window with the help of coordinates which can be provided as the input.
The definition of a clipping algorithm can be understood as a procedure with the help of which the algorithm is able to identify parts of the image that are inside or outside a specific region.
Also, this specific region is conventionally taken as rectangular in shape and all the parts of the images within this region are displayed and the other parts of the images are clipped away.
The clipping window is a region and this region is defined by some coordinates. Generally, the clipping window is taken as rectangular in shape and the rectangular clip window can be defined by four cartesian coordinates. These cartesian coordinates will have the form x-axis minimum, x-axis maximum, y-axis minimum, and y-axis maximum.
There are various types of clipping in computer graphics –
The point clipping tells us whether the points on our cartesian coordinate are lying within the boundary or outside the boundary of the clipping window, if the point lies outside the window then we have to clip the point and if it lies inside the window then we have to display it.
So the question comes how will you identify which are the points that are lying inside the window and which are lying outside and this can be done if we have the information about the coordinates of the clipping window. There will be minimum and maximum value on the x-axis (names as X-min and X-max) and on the y-axis (as Y-min and Y-max), this coordinate will determine the area of the clipping window and suppose our coordinate on the x-axis goes beyond the maximum of clipping window and our coordinate on the x-axis will be clipped off. Therefore it is very necessary to have coordinates of the clipping window for determining the coordinate of the clipping window to program or solve the numerical for clipping, as the coordinate which lies within the boundaries of the clipping window will only be used.
So, in order for the point clipping to work, it has fulfilled some of the inequalities, and if our coordinates fail to do so then they are clipped off.
X-min is less than equal to X-coordinate less than equal to X-max
Y-min is less than equal to Y-coordinate less than equal to Y-max
The line clipping in computer graphics refers to the removal of the lines or portions of the line that lies outside the clipping window. Cohen Sutherland Algorithm is the algorithm that is used for line clipping. There are some cases that exist in the line clipping –
Visible line clipping – In this line clipping, all the coordinate of the line exists inside of our clipping window. If the line is defined by two coordinates then both of the coordinates will lie inside the clipping window and therefore the line will not be clipped and will be displayed in the output.
Not Visible line clipping – In this line clipping, no coordinate of the line exists inside of our clipping window. If the line is defined by two coordinates then both of the coordinates will lie outside the clipping window and as a result the whole line will be clipped off and will not be displayed in the output.
Partially Visible – In this line clipping, some of the coordinates of the line will lie inside and some coordinates will lie outside of the clipping window. If the line is defined by two coordinates then one point will lie inside of the clipping window and the other will lie outside the clipping window, this way only some part of the line will be clipped and some part will be displayed in the output.
The polygon clipping is used to remove the portions of the polygon that does not lie in our clipping window. The polygon is a plane figure that is described by a finite number of straight lines that are connected to each other at an angle to form a close polygonal circuit. The polygon clipping is executed in computer graphics with the help of the Sutherland Hodgman algorithm.
The curve clipping removes the part of the closed curved figure which lies outside the boundary of the clipping window.