Unit-IV Windowing and Clipping
Second Year Diploma Courses in Computer Science & Engineering /
Computer Engineering / Computer Technology / Information Technology Branch.
Computer Graphics
As per MSBTE ‘I’ Scheme Syllabus
CGR-22318
Unit-IV
Windowing and Clipping
Total Marks- 18
Contents:
4.1 Windowing and Clipping Concept
4.2 Window to Viewport Transformation
4.3 Line Clipping
4.3.1 Cohen Sutherland Clipping Algorithm
4.3.2 Cyrus-beck Line Clipping Algorithm
4.3.3 Liang Barsky Line Clipping Algorithm
4.3.4 Midpoint Subdivision Line Clipping Algorithm
4.4 Polygon Clipping:
4.5 Text Clipping
CGR-22318 www.freestudyroom.xyz Page 1
, Unit-IV Windowing and Clipping
Unit-IV Windowing and Clipping
4.3.1 Windowing and Clipping Concept:
Window: world-coordinate area selected for display is called a window. A window defines a
rectangular area in world coordinates.
Windowing: The process of selecting and viewing the picture with different views is called
windowing.
Clipping: The process which is divides each elements of the picture into its visible and invisible
portions, allowing the invisible portion to be discarded is called clipping.
4.3.2 Window to Viewport Transformation:
The window defines what is to be viewed; the viewport defines where it is to be displayed.
1. Window-to-Viewport transformation is the process of transforming a two-dimensional, world-
coordinate scene to device coordinates.
2. In particular, objects inside the world or clipping window are mapped to the viewport. The
viewport is displayed in the interface window on the screen.
Figure: window and viewport
The picture is stored in the computer memory using any convenient Cartesian co-ordinate system,
referred to as World Co-Ordinate System (WCS). However, when picture is displayed on the display
device it is measured in Physical Device Co-Ordinate System (PDCS) corresponding to the display
device.
The viewing transformation which maps picture co-ordinates in the WCS to display co-ordinates in
PDCS is performed by the following transformations.
• Converting world co-ordinates to viewing co-ordinates.
• Normalizing viewing co-ordinates.
• Converting normalized viewing co-ordinates to device co-ordinates.
CGR-22318 www.freestudyroom.xyz Page 2
, Unit-IV Windowing and Clipping
Figure: Two-dimensional viewing-transformation pipeline.
The steps involved in viewing transformation:-
1. Construct the scene in world co-ordinate using the output primitives and attributes.
2. Obtain a particular orientation for the window by setting a two-dimensional viewing co-ordinate
system in the world co-ordinate plane and define a window in the viewing co-ordinate system.
3. Use viewing co-ordinates reference frame to provide a method for setting up arbitrary orientations
for rectangular windows.
4. Once the viewing reference frame is established, transform descriptions in world co-ordinates to
5. Define a view port in normalized co-ordinates and map the viewing co-ordinates description of the
scene to normalized co-ordinates.
6. Clip all the parts of the picture which lie outside the viewport.
4.3.3 Line clipping:
In line clipping, we will cut the portion of line which is outside of window and keep only the portion
that is inside the window.
The line clipping algorithms are:
1. Cohen Sutherland Line Clipping Algorithm
2. Cyrus-beck Line Clipping Algorithm
3. Liang-Barsky Line Clipping Algorithm
4. Midpoint Subdivision Line Clipping Algorithm
4.3.1 Cohen Sutherland Line Clipping Algorithm
This algorithm uses the clipping window as shown in the following figure. The minimum coordinate
for the clipping region is (XW_{min}, YW_{min}) and the maximum coordinate for the clipping
region is (XW_{max}, YW_{max}).
CGR-22318 www.freestudyroom.xyz Page 3
Second Year Diploma Courses in Computer Science & Engineering /
Computer Engineering / Computer Technology / Information Technology Branch.
Computer Graphics
As per MSBTE ‘I’ Scheme Syllabus
CGR-22318
Unit-IV
Windowing and Clipping
Total Marks- 18
Contents:
4.1 Windowing and Clipping Concept
4.2 Window to Viewport Transformation
4.3 Line Clipping
4.3.1 Cohen Sutherland Clipping Algorithm
4.3.2 Cyrus-beck Line Clipping Algorithm
4.3.3 Liang Barsky Line Clipping Algorithm
4.3.4 Midpoint Subdivision Line Clipping Algorithm
4.4 Polygon Clipping:
4.5 Text Clipping
CGR-22318 www.freestudyroom.xyz Page 1
, Unit-IV Windowing and Clipping
Unit-IV Windowing and Clipping
4.3.1 Windowing and Clipping Concept:
Window: world-coordinate area selected for display is called a window. A window defines a
rectangular area in world coordinates.
Windowing: The process of selecting and viewing the picture with different views is called
windowing.
Clipping: The process which is divides each elements of the picture into its visible and invisible
portions, allowing the invisible portion to be discarded is called clipping.
4.3.2 Window to Viewport Transformation:
The window defines what is to be viewed; the viewport defines where it is to be displayed.
1. Window-to-Viewport transformation is the process of transforming a two-dimensional, world-
coordinate scene to device coordinates.
2. In particular, objects inside the world or clipping window are mapped to the viewport. The
viewport is displayed in the interface window on the screen.
Figure: window and viewport
The picture is stored in the computer memory using any convenient Cartesian co-ordinate system,
referred to as World Co-Ordinate System (WCS). However, when picture is displayed on the display
device it is measured in Physical Device Co-Ordinate System (PDCS) corresponding to the display
device.
The viewing transformation which maps picture co-ordinates in the WCS to display co-ordinates in
PDCS is performed by the following transformations.
• Converting world co-ordinates to viewing co-ordinates.
• Normalizing viewing co-ordinates.
• Converting normalized viewing co-ordinates to device co-ordinates.
CGR-22318 www.freestudyroom.xyz Page 2
, Unit-IV Windowing and Clipping
Figure: Two-dimensional viewing-transformation pipeline.
The steps involved in viewing transformation:-
1. Construct the scene in world co-ordinate using the output primitives and attributes.
2. Obtain a particular orientation for the window by setting a two-dimensional viewing co-ordinate
system in the world co-ordinate plane and define a window in the viewing co-ordinate system.
3. Use viewing co-ordinates reference frame to provide a method for setting up arbitrary orientations
for rectangular windows.
4. Once the viewing reference frame is established, transform descriptions in world co-ordinates to
5. Define a view port in normalized co-ordinates and map the viewing co-ordinates description of the
scene to normalized co-ordinates.
6. Clip all the parts of the picture which lie outside the viewport.
4.3.3 Line clipping:
In line clipping, we will cut the portion of line which is outside of window and keep only the portion
that is inside the window.
The line clipping algorithms are:
1. Cohen Sutherland Line Clipping Algorithm
2. Cyrus-beck Line Clipping Algorithm
3. Liang-Barsky Line Clipping Algorithm
4. Midpoint Subdivision Line Clipping Algorithm
4.3.1 Cohen Sutherland Line Clipping Algorithm
This algorithm uses the clipping window as shown in the following figure. The minimum coordinate
for the clipping region is (XW_{min}, YW_{min}) and the maximum coordinate for the clipping
region is (XW_{max}, YW_{max}).
CGR-22318 www.freestudyroom.xyz Page 3