0% found this document useful (0 votes)
3 views

Lecture6

The lecture discusses the concept of clipping in computer graphics, where a clipping window defines the visible section of a scene, and objects outside this window are clipped. It covers various clipping algorithms, including point clipping, line clipping, and polygon fill-area clipping, detailing how lines and polygons are processed against the clipping boundaries. The Cohen-Sutherland algorithm is highlighted for line clipping, illustrating how endpoints are assigned region codes to determine their position relative to the clipping window.

Uploaded by

jthan3953
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Lecture6

The lecture discusses the concept of clipping in computer graphics, where a clipping window defines the visible section of a scene, and objects outside this window are clipped. It covers various clipping algorithms, including point clipping, line clipping, and polygon fill-area clipping, detailing how lines and polygons are processed against the clipping boundaries. The Cohen-Sutherland algorithm is highlighted for line clipping, illustrating how endpoints are assigned region codes to determine their position relative to the clipping window.

Uploaded by

jthan3953
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Lecture 6

Clipping

Associate Professor
Dr. Ashraf Abdelaziz Taha

Course Title: Computer Graphics


Semester: 1 2024 / 2025
Duration: 12 weeks
Concept of Clipping

A section of a two-dimensional scene that is selected for display is


called a clipping window because all parts of the scene outside the
selected section are “clipped” off.

The only part of the scene that shows up on the screen is what is inside
the clipping window.
Objects inside the clipping window are mapped to the viewport

-2-
A clipping window and associated viewport, specified as
rectangles aligned with the coordinate axes.

-3-
Mapping the Clipping Window into a Viewport

A point (xw, yw) in a world-coordinate clipping window is mapped to viewport


coordinates (xv, yv), so that the relative positions of the two points in their respective
rectangles are the same.

-4-
Clipping Algorithms

• Point clipping
• Line clipping (straight-line segments)
• Fill-area clipping (polygons)

-5-
Two-Dimensional Point Clipping

P = (x, y)
xmin ≤ x ≤ xmax
ymin ≤ y ≤ ymax

-6-
Two-Dimensional Line Clipping

First, determine whether a line segment is completely inside the clipping window
or completely outside.
Perform intersection calculations to determine whether any part of the line
crosses the window interior.

-7-
• When both endpoints of a line segment are inside all four clipping
boundaries, such as the line from P1 to P2, the line is completely
inside the clipping window.

• When both endpoints of a line segment are outside any one of the
four boundaries, such as the line P3 to P4, the line is completely
outside the window.

-8-
Cohen-Sutherland Line Clipping

Thus, an endpoint that is below and to the left of the clipping window is assigned the
region code 0101, and the region-code value for any endpoint inside the clipping
window is 0000. -9-
-10-
Polygon Fill-Area Clipping

A line-clipping algorithm applied to


the line segments of the polygon boundary in (a) Display of a correctly clipped polygon fill area.
generates the unconnected set of lines in (b).

-11-
Processing a polygon fill area against successive clipping-window boundaries.

-12-

You might also like