Home »
Computer Graphics
Clipping in Computer Graphics
This article is about Clipping in computer graphics. In this article, we will briefly study what Clipping is and what are the types of clipping? We will also be studying the various conditions where we feel the need to perform clipping in computer graphics.
By Monika Sharma Last updated : April 05, 2024
Why Clipping is Required?
While transforming a window port to a viewport, there may occur conditions where the aspect ratio of both the ports are alike. In such situations, we need to modify the captured window to fit it in the viewport. Sometimes we need to show a large portion of the picture, sometimes only some specific parts. In such cases, not only scaling & translation is necessary, as the visible part of the picture is also identified by these methods. So, this process is not as easy as it appears to be. Hence, to achieve this, we perform clipping on the window port.
The mapping of the window port to the viewport can be thought as of placing a frame over a picture where the frame is out of viewport and the picture is the window. If the picture is larger than the frame, then certain parts of the image lie inside, while others are partially inside and some lie completely outside the frame. Thus, the lines or elements which are outside the frame cannot be fitted into it. Thus we cut them off to fit the picture into the frame. In the same manner, in computer graphics, we perform clipping.
Conditions that occur while viewing transformation
There are three conditions that may occur while performing window to view port transformation:
Case 1: A simple line or lines entirely lie inside the window. Such lines are considered as visible lines.
Case 2: A simple line lies entirely outside the window. Such lines are considered as invisible lines.
Case 3: A simple line partially lies inside the window and partially outside. In such conditions, we need to perform clipping. Thus, the clipping point of the intersection of a line with the window is determined.
So, for deciding the visible and invisible portion from the picture, clipping is performed on it. Clipping determines each element into the visible and invisible portion by omitting the extra part. So, the visible portion is selected. And an invisible portion is discarded.
The clipping can be performed either by hardware devices or by software devices. However, the clipping through hardware devices was used in earlier times. Nowadays, we use software clipping. The basic idea of clipping can be understood with the following diagram:
Types of Clipping
The types of clipping are determined by the shape that is clipped. The following are the types of clipping.
- Point Clipping: Performed on a point
- Line Clipping: Performed on a line
- Area Clipping (Polygon): Performed on various types of polygons
- Curve Clipping: Performed on curved lines and shapes
- Text Clipping: Performed on texts.
- Exterior Clipping: Performed without knowing about the content of the image.
Applications of clipping
The clipping process finds its wide use in computer graphics. As we have already seen its very important and crucial role in the window to view port transformation, the following are some the areas in this process where the clipping finds its application:
- To extract the part of image that we desire.
- To identify the invisible and visible area in the 3D object plane.
- For enabling zooming feature in our screens.
- For creating objects using solid modeling.
- For drawing operations.
- To perform the operations related to the pointing of an object.
- To delete, copy, or move part of an object.