Clipping
Clipping
When we have to display a large portion of the picture, then not only scaling & translation is necessary, the
visible part of picture is also identified. This process is not easy. Certain parts of the image are inside, while
others are partially inside. The lines or elements which are partially visible will be omitted.
For deciding the visible and invisible portion, a particular process called clipping is used. Clipping determines
each element into the visible and invisible portion. Visible portion is selected. An invisible portion is discarded.
Types of Lines:
Lines are of three types:
• Visible: A line or lines entirely inside the window is considered visible
• Invisible: A line entirely outside the window is considered invisible
• Clipped: A line partially inside the window and partially outside is clipped. For clipping point of
intersection of a line with the window is determined.
Clipping can be applied through hardware as well as software. In some computers, hardware devices
automatically do work of clipping. In a system where hardware clipping is not available software clipping
applied.
Following figure show before and after clipping
The window against which object is clipped called a clip window. It can be curved or rectangle in shape.
Applications of clipping:
• It will extract part we desire.
• For identifying the visible and invisible area in the 3D object.
• For creating objects using solid modeling.
• For drawing operations.
• Operations related to the pointing of an object.
• For deleting, copying, moving part of an object.
Clipping can be applied to world co-ordinates. The contents inside the window will be mapped to device co-
ordinates. Another alternative is a complete world co-ordinates picture is assigned to device co-ordinates, and
then clipping of viewport boundaries is done.
Types of Clipping:
• Point Clipping
• Line Clipping
• Area Clipping (Polygon)
• Curve Clipping
• Text Clipping
• Exterior Clipping
1. Point Clipping
• Definition: Determines whether a single point is inside or outside a clipping window.
• Use: Simplest form of clipping, often used as a preliminary check for more complex clipping operations.
2. Line Clipping
• Definition: Involves clipping line segments against a clipping window.
Algorithms:
• Cohen-Sutherland Algorithm: Uses a region code for each endpoint of a line segment to quickly reject
or accept lines.
• Liang-Barsky Algorithm: Efficiently clips lines using parametric equations and the intersection points
with the clipping window boundaries.
3. Polygon Clipping
• Definition: Clips entire polygons against a clipping window.
Algorithms:
• Sutherland-Hodgman Algorithm: Clips polygons against a rectangular clipping window by processing
vertices and edges.
• Weiler-Atherton Algorithm: Handles more complex polygon clipping, including polygons with holes
and intersecting edges.
4. Curve Clipping
• Definition: Clipping curves, such as Bézier curves or other parametric curves, against a clipping
window.
• Algorithms: Often more complex due to the nature of curves, and may involve approximating the
curve with line segments before applying clipping algorithms.
5. Text Clipping
• Definition: Clips text characters or strings against a clipping region.
• Use: Ensures that only the visible portions of text are rendered, especially in user interfaces or
graphics.
6. Rectangle Clipping
• Definition: Clips rectangular shapes or images against a clipping rectangle.
• Use: Common in 2D graphics, where rectangles are frequently used for various elements.
7. Window Clipping
• Definition: Clipping graphical objects based on a defined viewport or window, often used in graphical
user interfaces and rendering pipelines.
• Use: Ensures that only the content within the viewport is drawn or processed.
8. Exterior clipping:
• Exterior clipping, also known as "outside clipping," refers to the process of removing parts of graphical
objects that fall outside a defined clipping boundary or viewport.