CG U2 Technical
CG U2 Technical
Syllabus
Polygons : Introduction to polygon, types : convex, concave and complex. Inside test.
Contents
4.1 Introduction to Polygon . . . . . . . . . . . . . . . . . . Dec.-06, May-11,12, · · · · · · · Marks 4
4.2 Types : Convex, Concave and Complex . . . . . Dec.-06, 09,18,
. . . . . . . . . . . . . . . . . . May-05, 10, 11, 12, · · · · · · · · Marks 4
4.3 Representation of Polygon
4.4 Inside Test . . . . . . . . . . . . . . . . . . Dec.-06, 09, 10, 12, 14, 15,18
. . . . . . . . . . . . . . . . . . May-05, 07, 10, 13, 16,19 · · · Marks 6
4.5 Polygon Filling Algorithms . . . . . . . . . . . . . . . . May-05, 06, 07, 08, 09, 10, 11, 12, 13,
. . . . . . . . . . . . . . . . . . 14, 15,18,19
. . . . . . . . . . . . . . . . . . Dec.-05, 06, 07, 08, 09, 10, 11,
. . . . . . . . . . . . . . . . . . 12, 15,19 · · · · · · · · · · · · · · · Marks 16
TM
In this chapter we are going to study different types of polygons, their representation
and filling algorithms for them.
· A polyline is a chain of connected line segments.
· The classification of polygons is based on where the line segment joining any two
points within the polygon is going to lie. There are three types of polygons :
n Convex
n Concave and
n Complex
· A convex polygon is a polygon in which the line segment joining any two points
within the polygon lies completely inside the polygon. Fig. 4.2.1 shows the
examples of convex polygons.
E
D
B C
A F
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4-3 Polygons and Polygon Filling
· A concave polygon is a polygon in which the line segment joining any two points
within the polygon may not lie completely inside the polygon. Fig. 4.2.2 shows the
examples of concave polygons.
A F
C D
B E
Review Questions
· Most of the other graphics devices do not provide any polygon support at all. In
such cases polygons are represented using lines and points. A polygon is
represented as a unit and it is stored in the display file. In a display file polygon
can not be stored only with series of line commands because they do not specify
how many of the following line commands are the part of the polygon. Therefore,
new command is used in the display file to represent polygons. The opcode for
new command itself specify the number of line segments in the polygon. The
Fig. 4.3.2 shows the polygon and its representation using display file.
2 0 2
Fig. 4.3.2 Polygon and its representation using display file
Review Question
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4-5 Polygons and Polygon Filling
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4-6 Polygons and Polygon Filling
Review Questions
3. Explain the winding number method. Does the method supports intersection polygons?
SPPU : Dec.-06, Marks 4
4. Write and explain any one inside test algorithm. SPPU : Dec.-18, May-19, Marks 4
· Filling the polygon means highlighting all the pixels which lie inside the polygon
with any colour other than background colour. Polygons are easier to fill since
they have linear boundaries.
· There are two basic approaches used to fill the polygon.
· One way to fill a polygon is to start from a given "seed", point known to be inside
the polygon and highlight outward from this point i.e. neighbouring pixels until
we encounter the boundary pixels. This approach is called seed fill because colour
flows from the seed pixel until reaching the polygon boundary, like water flooding
on the surface of the container.
· Another approach to fill the polygon is to apply the inside test i.e. to check
whether the pixel is inside the polygon or outside the polygon and then highlight
pixels which lie inside the polygon. This approach is known as scan-line
algorithm. It avoids the need for a seed pixel but it requires some computation.
Let us see these two methods in detail.
· The seed fill algorithm is further classified as flood fill algorithm and boundary fill
algorithm.
· Algorithms that fill interior-defined regions are called flood-fill algorithms; those
that fill boundary-defined regions are called boundary-fill algorithms or edge-fill
algorithms.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4-7 Polygons and Polygon Filling
whether the boundary pixel is reached. If boundary pixels are not reached, pixels
are highlighted and the process is continued until boundary pixels are reached.
· Boundary defined regions may be either 4-connected or 8-connected as shown in
the Fig. 4.5.1.
· If a region is 4-connected, then every pixel in the region may be reached by a
combination of moves in only four directions : left, right, up and down.
· For an 8-connected
region every pixel in the
region may be reached
by a combination of
moves in the two
horizontal, two vertical
(a) Four connected region (b) Eight connected region
and four diagonal
Fig. 4.5.1
directions.
· In some cases, an 8-connected algorithm is more accurate than the 4-connected
algorithm. This is illustrated in Fig. 4.5.2. Here, a 4-connected algorithm produces
the partial fill.
Seed
· The following procedure illustrates the recursive method for filling a 4-connected
region with colour specified in parameter fill colour (f-colour) up to a boundary
colour specified with parameter boundary colour (b-colour)
Procedure : boundary_fill (x, y, f_colour, b_colour)
{
if (getpixel (x,y) ! = b_colour && getpixel (x, y) ! = f_colour)
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4-8 Polygons and Polygon Filling
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4-9 Polygons and Polygon Filling
· Recursive algorithm for seed fill methods have got two difficulties :
n The first difficulty is that if some inside pixels are already displayed in fill
colour then recursive branch terminates, leaving further internal pixels
unfilled. To avoid this difficulty, we have to first change the colour of any
internal pixels that are initially set to the fill colour before applying the seed
fill procedures.
n Another difficulty with recursive seed fill methods is that it cannot be used
for large polygons. This is because recursive seed fill procedures require
stacking of neighbouring points and in case of large polygons stack space
may be insufficient for stacking of neighbouring points.
· To avoid this problem more efficient method can be used. Such method fills
horizontal pixel spans across scan lines, instead of proceeding to 4-connected or
8-connected neighbouring points. This is achieved by identifying the rightmost and
leftmost pixels of the seed pixel and then drawing a horizontal line between these
two boundary pixels. This procedure is repeated with changing the seed pixel
above and below the line just drawn until complete polygon is filled. With this
efficient method we have to stack only a beginning position for each horizontal
pixel span, instead of stacking all unprocessed neighbouring positions around the
current position.
· Fig. 4.5.3 illustrates the scan line
y
algorithm for filling of polygon.
· For each scan line crossing a polygon,
this algorithm locates the intersection Scan line
points of the scan line with the polygon
edges. These intersection points are then
sorted from left to right and the x
corresponding positions between each 6 9 12 15
intersection pair are set to the specified
fill colour. Fig. 4.5.3
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4 - 10 Polygons and Polygon Filling
· In Fig. 4.5.3, we can see that there are two stretches of interior pixels from x = 6 to
x = 9 and x = 12 to x = 15.
· The scan line algorithm first finds the largest and smallest y values of the
polygon. It then starts with the largest y value and works its way down, scanning
from left to right, in the manner of a raster display.
· The important task in the scan line algorithm is to find the intersection points of
the scan line with the polygon boundary.
· When intersection points are even, they are sorted from left to right, paired and
pixels between paired points are set to the fill colour.
· In some cases intersection
y
point is a vertex. When scan
line intersects polygon vertex B D
a special handling is 1 C
required to find the exact A 2 3 4 G Scan line 1
1 E 3 4
Scan line 2
intersection points. To handle 2 F H
Scan line 3
such cases, we must look at 1 2 3 4
J I
the other endpoints of the
x
two line segments of the 0
polygon which meet at this
Fig. 4.5.4 Intersection points along the scan line
vertex. If these points lie on that intersect polygon vertices
the same (up or down) side
of the scan line, then the point in question counts as an even number of
intersections. If they lie on opposite sides of the scan line, then the point is
counted as single intersection. This is illustrated in Fig. 4.5.4.
· As shown in Fig. 4.5.4, each scan line intersects the vertex or vertices of the
polygon.
· For scan line 1, the other end points (B and D) of the two line segments of the
polygon lie on the same side of the scan line, hence there are two intersections
resulting two pairs : 1 - 2 and 3 - 4. Intersections points 2 and 3 are actually same
points.
· For scan line 2 the other endpoints (D and F) of the two line segments of the
polygon lie on the opposite sides of the scan line, hence there is a single
intersection resulting two pairs : 1 - 2 and 3 - 4.
· For scan line 3, two vertices are the intersection points. For vertex F the other end
points E and G of the two line segments of the polygon lie on the same side of
the scan line whereas for vertex H, the other endpoints G and I of the two line
segments of the polygon lie on the opposite side of the scan line. Therefore, at
vertex F there are two intersections and at vertex H there is only one intersection.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4 - 11 Polygons and Polygon Filling
· This results two pairs : 1 - 2 and 3 - 4 and points 2 and 3 are actually same
points.
· It is necessary to calculate x intersection points for scan line with every polygon
side.
· We can simplify these calculations by using coherence properties.
· A coherence property of a scene is a property of a scene by which we can relate
one part of a scene with the other parts of a scene. Here, we can use a slope of an
edge as a coherence property. By using this property we can determine the x
intersection value on the lower scan line if the x intersection value for current scan
line is known. This is given as
1
xi + 1 = xi –
m
· Once the sides are sorted we can Fig. 4.5.5 Consider only the sides which
process the scan lines from the top intersect the scan line
of the polygon to its bottom
producing an active edge list for each scan line crossing the polygon boundaries.
· The active edge list for a scan line contains all edges crossed by that scan line.
· Fig. 4.5.6 shows sorted edges of the polygon with active edges.
· A scan line algorithm for filling a polygon begins by ordering the polygon sides
on the largest y value.
· It begins with the largest y value and scans down the polygon.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4 - 12 Polygons and Polygon Filling
BC
B D BA
C DC
G
A DE
E AJ Top
Scan line
F GF Active
H
edges
GH
J I EF Bottom
HI
JI
· For each y, it determines which sides can be intersected and finds the x values of
these intersection points.
· It then sorts, pairs and passes these x values to a line drawing routine.
Scan Line Conversion Algorithm for Polygon Filling :
1. Read n, the number of vertices of polygon
2. Read x and y coordinates of all vertices in array x[n] and y[n].
3. Find ymin and ymax.
4. Store the initial x value (x1) y values y1 and y2 for two endpoints and x increment
Dx from scan line to scan line for each edge in the array edges [n] [4].
While doing this check that y1 > y2, if not interchange y1 and y2 and
corresponding x1 and x2 so that for each edge, y1 represents its maximum
y coordinate and y2 represents its minimum y coordinate.
5. Sort the rows of array, edges [n] [4] in descending order of y1, descending order
of y2 and ascending order of x2.
6. Set y = ymax
7. Find the active edges and update active edge list :
if (y > y2 and y £ y1)
{ edge is active }
else
{ edge is not active }
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4 - 13 Polygons and Polygon Filling
8. Compute the x intersects for all active edges for current y value [initially
x-intersect is x1 and x intersects for successive y values can be given as
xi + 1 ¬ xi + Dx
1 y -y1
where Dx =– and m = 2 i.e. slope of a line segment
m x2 - x1
9. If x intersect is vertex i.e. x-intersect = x1 and y = y1 then apply vertex test to
check whether to consider one intersect or two intersects. Store all x intersects in
the x-intersect [ ] array.
10. Sort x-intersect [ ] array in the ascending order,
11. Extract pairs of intersects from the sorted x-intersect [ ] array.
12. Pass pairs of x values to line drawing routine to draw corresponding line
segments
13. Set y = y – 1
14. Repeat steps 7 through 13 until y ³ ymin.
15. Stop
In step 7, we have checked for y £ y1 and not simply y < y1. Hence step 9 a becomes
redundant. Following program takes care of that.
Review Questions
4. What are the steps involved in filling polygon in scan line method?
SPPU : Dec.-05,06,08, May-06,07,08,18,19, Marks 8
5. Explain with example and compare seed-fill and edge-fill algorithm for polygon.
SPPU : May-06,10, Dec.-07, 09, Marks 8
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 4 - 14 Polygons and Polygon Filling
7. Explain how a polygon is filled with pattern. SPPU : Dec.-12, May-13, Marks 4
8. List various polygon filling algorithms. Explain scan line algorithm with mathematical formulation
SPPU : May-11, Marks 16
10. State the characteristics of scan line polygon fill algorithm and compare it with boundary fill
algorithm. SPPU : May-09, 10, Marks 8
11. Explain Scanline algorithm for polygon filling and explain how it can be extended for hidden
removal. SPPU : Dec.-10, Marks 10
12. Explain scan line algorithm with example. SPPU : May-14,19, Marks 6
13. What is scan line polygon filling algorithm ? Explain with an example.
SPPU : May-12, Marks 10
14. Describe scan line algorithm to generate solid area on the screen. SPPU : Dec.-11, Marks 8
15. Write algorithm to fill the polygon area using flood fill method. SPPU : May-15, Marks 4
qqq
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
UNIT - II
Syllabus
Viewing transformations, 2-D clipping: Cohen- Sutherland algorithm line Clipping algorithm,
Sutherland Hodgeman Polygon clipping algorithm, Weiler Atherton Polygon Clipping algorithm.
Contents
5.1 Introduction . . . . . . . . . . . . . . . . . . May-05,13, Dec.-05,12, · · · Marks 4
5.2 Viewing Transformations . . . . . . . . . . . . . . . . . May-05,12, Dec.-10,11,19 · Marks 8
5.3 2 D Clipping . . . . . . . . . . . . . . . . . . May-07,12 · · · · · · · · · · · · · · Marks 2
5.4 Cohen-Sutherland Line Clipping Algorithm . . . May-06,07,08,10,11,12,13, 15, 16,17,19
. . . . . . . . . . . . . . . . . . Dec.-10, 15,18 · · · · · · · · · · Marks 8
5.5 Polygon Clipping . . . . . . . . . . . . . . . . . . Dec.-05,06,07,08,11,14,17,18
. . . . . . . . . . . . . . . . . . May-07,10,14, · · · · · · · · · · · Marks 8
5.6 Generalized Clipping . . . . . . . . . . . . . . . . . . Dec.-07,11,12, May-09, · · · Marks 8
5.7 Interior and Exterior Clipping . . . . . . . . . . . . . . May-05,13, Dec.-05,12, · · · Marks 4
TM
· We have to identify the visible part of the picture for inclusion in the display
image. This selection process is not straight forward. Certain lines may lie partly
inside the visible portion of the picture and partly outside. These lines cannot be
omitted entirely from the display image because the image would become
inaccurate. This is illustrated in Fig. 5.1.1.
· The process of selecting and viewing the picture with different views is called
windowing, and a process which divides each element of the picture into its
visible and invisible portions, allowing the invisible portion to be discarded is
called clipping.
· The picture is stored in the computer memory using any convenient Cartesian
co-ordinate system, referred to as World Co-ordinate System (WCS).
· When picture is displayed on the display device it is measured in Physical Device
Co-ordinate System (PDCS) corresponding to the display device. Therefore,
displaying an image of a picture involves mapping the co-ordinates of the points
and lines that form the picture into the appropriate physical device co-ordinate
where the image is to be displayed. This mapping of co-ordinates is achieved with
the use of co-ordinate transformation known as viewing transformation.
· Sometimes the two dimensional viewing transformation is simply referred to as
the window to view port transformation or the windowing transformation.
· The viewing transformation which maps picture co-ordinates in the WCS to
display co-ordinates in PDCS is performed by the following transformations.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5-3 Windowing and Clipping
Determine
Convert
world - Convert
normalized
MC co-ordinate WC world VC Normalize NVC DC
viewing
of scene using co-ordinates viewing
co-ordinates
modeling - to viewing co-ordinates
to device
co-ordinate co-ordinates
co-ordinates
transformations
· World Co-ordinate System (WCS) is infinite in extent and the device display area
is finite.
· To perform a viewing transformation we select a finite world co-ordinate area for
display called a window.
· An area on a device to which a window is mapped is called a viewport.
· The window defines what is to be viewed; the viewport defines where it is to be
displayed, as shown in the Fig. 5.2.1 (b).
Window yv max
yw max
View port
yw min yv min
xv min xv max
xw min xw max
5. Define a view port in normalized co-ordinates and map the viewing co-ordinate
description of the scene to normalized co-ordinates.
6. Clip all the parts of the picture which lie outside the viewport.
y0
T
x view
x0 x world x world
R
x
vi
ew
Fig. 5.2.2
where T is the translation matrix that takes the viewing origin point P0 to the world
origin, and R is the rotation matrix that aligns the axes of the two reference frames.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5-5 Windowing and Clipping
where
x : Actual device x co-ordinate.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5-6 Windowing and Clipping
ywmax
yvmax
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5-7 Windowing and Clipping
Solving these equations for the viewport position (xv, yv) we have,
xv = xvmin + (xw – xwmin) sx
yv = yvmin + (yw – ywmin) sy
Normalized space
1
View port
Window 1 Window 2
0 1
Monitor 1 Monitor 2
Fig. 5.2.6 Mapping selected portion of the scene in normalized co-ordinates to different
monitors with workstation transformations
éSx 0 0ù
x v max - x v min
S = ê0 Sy 0ú where Sx =
ê ú x w max - x w min
êë 0 0 1úû
y vmax - y vmin
Sy =
y wmax - y wmin
é 1 0 0ù
–1 ê ú
T = ê 0 1 0ú
ê x v min y vmin 1úû
ë
· The overall transformation matrix for W is given as
W = T × S × T –1
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5-9 Windowing and Clipping
Object Translate
Window
Scale Translate
é 1 0 0ù éSx 0 0ù é 1 0 0ù
ê ú ê0 ê ú
= ê 0 1 0ú Sy 0ú ê 0 1 0ú
ê ú
ê - X w min - y w min 1úû êë 0 0 1úû ê x v min y v min 1úû
ë ë
é Sx 0 0ù
ê ú
= ê 0 Sy 0ú
ê x vmin - x w min . S x y v min - y w min . S y 1úû
ë
· Fig. 5.2.8 shows the complete viewing transformation.
Workstation transformation
Viewing transformation
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 10 Windowing and Clipping
Applications
· By changing the position of the viewport, we can view objects at different
positions on the display area of an output device.
· By varying the size of viewports, we can change the size and proportions of
displayed objects.
· We can achieve zooming effects by successively mapping different-sized windows
on a fixed-size viewport.
Example 5.2.1 Find the normalization transformation window to viewpoint, with window,
lower left corner at (1, 1) and upper right corner at (3, 5) onto a viewpoint with lower left
corner at (0, 0) and upper right corner at (1/2, 1/2).
Solution : Given : Co-ordinates for window
xw min = 1 yw min = 1
xw max = 3 yw max = 5
We know that,
x v max - x v min 0 .5 - 0
Sx = = = 0.25
x w max - x w min 3 -1
y v max - y v min 0 .5 - 0
and Sy = = = 0.125
y w max - y w min 5 -1
é 0 . 25 0 0ù
= ê 0 0 . 125 0ú
ê ú
êë 0 - (1 ´ 0 . 25) 0 - (1 ´ 0 . 125) 1úû
é 0 . 25 0 0ù
= ê 0 0 . 125 0ú
ê ú
êë - 0 . 25 - 0 . 125 1úû
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 11 Windowing and Clipping
Example 5.2.2 Find the normalization transformation N that uses the rectangle
A (1, 1), B (5, 3), C (4, 5), D (0, 3) as a window and the normalized device screen as a
viewport.
Solution : To align rectangle about A we have to rotate it with the co-ordinate axes.
Then we can calculate, S x and S y and finally we compose the rotation and the
transformation N to find the required normalization transformation N R .
The slope of the line segment AB is,
3 -1 1
m = =
5 -1 2
The Fig. 5.2.9 (a) shows the specified window and viewport. As shown in the
Fig. 5.2.9 (a), the angle of rotation is - q and it is given by,
2 1
tan q = =
4 2
y
C(4, 5)
3 (0, 1) (1,1)
D B(5, 3)
The x extent of the rotated window is the length of AB. Similarly, the y extent is the
length of AD. Using the distance formula we can calculate these length as,
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 12 Windowing and Clipping
d (A, B) = 22 + 4 2 = 20 = 2 5
d (A, D) = 12 + 22 = 5
Also, the x extent of the normalized device screen is 1, as is the y extent. Calculating
s x and s y ,
Viewport x extent 1
sx = =
Window x extent 2 5
Viewport y extent 1
sy = =
Window y extent 5
é sx 0 0ù
ê ú
We have, N = ê 0 sy 0ú
ê - s x x W min + x V min - s y y W min + y V min 1úû
ë
é 1 1 ù
ê 5 - 0ú
5
ê 1 2 ú
= ê 0ú
10 5
ê- 3 -1 ú
ê 1ú
ë 10 5 û
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 13 Windowing and Clipping
Example 5.2.3 Find the complete viewing transformation that maps a window in world
coordinates with x extent 1 to 10 and y extent 1 to 10 onto a viewport with x extent 1 4
to 3 4 and y extent 0 to 1 2 in normalized device space and then maps a workstation
window with x extent 1 4 to 1 2 and y extent 1 4 to 1 2 in the normalized device space
into a workstation viewport with x extent 1 to 10 and y extent 1 to 10 on the physical
display device.
Solution : For normalization transformation
é sx 0 0ù
ê ú
T = ê 0 sy 0ú
ê - s x x wmin + x vmin - s y y wmin + y vmin 1úû
ë
The given parameters are x wmin = 1, x wmax = 10, y wmin = 1,
1
y wmax = 10, x vmin = 1 4, x vmax = 3 4, y vmin = 0, and y vmax =
2
3 1 1
Viewport x extent - 1
\ sx = = 4 4 = 2 =
Window x extent 10 - 1 9 18
1 1
Viewport y extent - 0 1
sy = = 2 = 2 =
Window y extent 10 - 1 9 18
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 14 Windowing and Clipping
é1 ù
ê 18 0 0ú
é 36 0 0ù é 2 0 0ù
ê 1 ú ê 0 ú ê
T = ê0 0ú 36 0 = 0 2 0ú
18 ê ú ê ú
ê7 1 ú êë - 8 - 8 1úû êë - 1 - 10 1úû
ê - 1ú
ë 36 18 û
Review Questions
· The procedure that identifies the portions of a picture that are either inside or
outside of a specified region of space is referred to as clipping.
· The region against which an object is to be clipped is called a clip window or
clipping window. It usually is in a rectangular shape, as shown in the Fig. 5.3.1.
· The clipping algorithm determines which points, lines or portions of lines lie
within the clipping window. These points, lines or portions of lines are retained
for display. All others are discarded.
P9
Clipping window
P4
P2 P2
P10
P11
P1 P12 P1 P12
P8
P6 P6
P5 P8'
P3 P'5
P7'
P7
(a) Before clipping (b) After clipping
Fig. 5.3.1
5.3.1 Point Clipping
The equal sign indicates that points on the window boundary are included within the
window.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 15 Windowing and Clipping
· The lines are said to be interior to the clipping window and hence visible if both
end points are interior to the window, e.g. line P1 P2 in Fig. 5.3.1.
· If both end points of a line are exterior to the window, the line is not necessarily
completely exterior to the window, e.g. line P7 P8 in Fig. 5.3.1.
· If both end points of a line are completely to the right of, completely to the left of,
completely above, or completely below the window, then the line is completely
exterior to the window and hence invisible. For example, line P3 P4 in Fig. 5.3.1.
· The lines which across one or more clipping boundaries require calculation of
multiple intersection points to decide the visible portion of them.
· To minimize the intersection calculations and to increase the efficiency of the
clipping algorithm, initially, completely visible and invisible lines are identified
and then the intersection points are calculated for remaining lines.
· There are many line clipping algorithms. Let us discuss a few of them.
Review Questions
· This is one of the oldest and most popular line clipping algorithm developed by
Dan Cohen and Ivan Sutherland.
· To speed up the processing this algorithm performs initial tests that reduce the
number of intersections that must be calculated.
· This algorithm uses a four digit (bit) code to indicate which of nine regions
contain the end point of line.
· The four bit codes are called region codes or 1001 1000 1010
outcodes. These codes identify the location of
the point relative to the boundaries of the 0000
0001 window 0010
clipping rectangle as shown in the Fig. 5.4.1.
· Each bit position in the region code is used to
indicate one of the four relative co-ordinate 0101 0100 0110
positions of the point with respect to the
clipping window : to the left, right, top or Fig. 5.4.1 Four-bit codes for nine
regions
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 16 Windowing and Clipping
bottom. The rightmost bit is the first bit and the bits are set to 1 based on the
following scheme :
n Set Bit 1 - if the end point is to the left of the window
n Set Bit 2 - if the end point is to the right of the window
n Set Bit 3 - if the end point is below the window
n Set Bit 4 - if the end point is above the window
Otherwise, the bit is set to zero.
· Once we have established region codes for all the line endpoints, we can
determine which lines are completely inside the clipping window and which are
clearly outside.
· Any lines that are completely inside the window boundaries have a region code of
0000 for both endpoints and we trivially accept these lines.
· Any lines that have a 1 in the same bit position in the region codes for each
endpoint are completely outside the clipping rectangle, and we trivially reject
these lines.
· A method used to test lines for total clipping is equivalent to the logical AND
operator.
· If the result of the logical AND operation with two end point codes is not 0000,
the line is completely outside the clipping region.
· The lines that cannot be identified as completely inside or completely outside a
clipping window by these tests are checked for intersection with the window
boundaries.
Example 5.4.1 Consider the clipping window and the lines shown in Fig. 5.4.2. Find the
region codes for each end point and identify whether the line is completely visible, partially
visible or completely invisible.
P9
P4
P2
P10
P1 P8
P6
P3 P5
P7
Fig. 5.4.2
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 17 Windowing and Clipping
Solution : The Fig. 5.4.3 shows the clipping window and lines with region codes. These
codes are tabulated and end point codes are logically ANDed to identify the visibility of
the line in Table 5.4.1.
P4 P2
P10
0001 P1 0000 P8 0010
P6
P5
P3
P7
0101 0100 0110
Fig. 5.4.3
Table 5.4.1
· The Cohen-Sutherland algorithm begins the clipping process for a partially visible
line by comparing an outside endpoint to a clipping boundary to determine how
much of the line can be discarded. Then the remaining part of the line is checked
against the other boundaries, and the process is continued until either the line is
totally discarded or a section is found inside the window.
This is illustrated in Fig. 5.4.4.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 18 Windowing and Clipping
P2 P2 P2
P1' P1'
P1 P1
P2
P2' P2'
P1' P1'
(d) (e)
Fig. 5.4.4 Sutherland-Cohen subdivision line clipping
· As shown in the Fig. 5.4.4, line P1 P2 is a partially visible and point P1 is outside
the window. Starting with point P1, the intersection point P1¢ is found and we get
two line segments P1 – P1¢ and P1¢ – P2.
· We know that, for P1 – P1¢ one end point i.e. P1 is outside the window and thus
the line segment P1 – P1¢ is discarded.
· The line is now reduced to the section from P1¢ to P2. Since P2 is outside the clip
window, it is checked against the boundaries and intersection point P2¢ is found.
Again the line segment is divided into two segments giving P1¢ – P2¢ and P2¢ – P2 .
We know that, for P2¢ – P2 one end point i.e. P2 is outside the window and thus the
line segment P2¢ – P2 is discarded.
· The remaining line segment P1¢ – P2¢ is completely inside the clipping window and
hence made visible.
· The intersection points with a clipping boundary can be calculated using the
slope-intercept form of the line equation.
· The equation for line passing through points P1 (x1, y1) and P2 (x2, y2) is
y = m(x – x1) + y1 or y = m(x – x2) + y2 … (5.4.1)
y2 -y1
where m = (slope of the line)
x2 - x1
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 19 Windowing and Clipping
· Therefore, the intersections with the clipping boundaries of the window are given
as :
n Left : xL, y = m(xL – x1) + y1 ; m¹¥
n Right : xR, y = m(xR – x1) + y1 ; m¹¥
1
n Top : yT, x = x1 + æç ö÷ (yT – y1) ; m¹0
è mø
1
n Bottom : yB, x = x1 + æç ö÷ (yB – y1) ; m¹0
è mø
6 45 - 15 6
xL, y = m (xL – x) + y1 = (50 – 40) + 15 m= =
7 75 - 40 7
10 - 20 - 10 - 1 (50,40)
(80,40)
Slope m ¢ = = =
100 - 70 30 3
-1
x R , y = m (xR – x1) + y1 = (80 – 70) + 20 = 16.66 I 2 (80,16.66)
3
I = (80, 16.66) (50,10) (80,10)
Fig. 5.4.6 (a)
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 21 Windowing and Clipping
Solution : xL = – 8 yB = – 4
x R = 12 yT = 8
P2 1010
6 1
Slope of line : m = =
30 5 P2
1 (17, 11)
xL, y = m (xL – x) + y1 = (– 8 – (– 13)) + 5 I2
5 (–8, 8) (12, 8)
I1
1
= (– 8 + 13) + 5 = 1 + 5 = 6
5 (–13, 5)
P1
1
y T , x = x1 + (y T - y) + x = – 13 + 5 (8 – 5)
m (–8, –4) (12, –4)
I1 = (xL , xL,y) = (– 8, 6) (
I 2 = YT, x , YT ) = (2, 8)
Example 5.4.4 Let R be the rectangular window whose lower left-hand corner is at L ( - 3, 1)
and upper right-hand corner is at R (2, 6). If the line segment is defined with two and
points with A ( - 4, 2) and B( - 1, 7),
a) The region codes of the two end points.
b) Its clipping category and
c) Stages in the clipping operations using Cohen-sutherland algorithm.
Solution :
a) Region of code for point A = 0001
Region of code for point B = 1000
b) Since (0001) AND (1000) = 0000 line segment AB is partially visible.
c) Stages in the clipping line segment AB are :
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 22 Windowing and Clipping
1. To push the 1 to 0 in code for A (0001), we clip against the window boundary
line x min = - 3.
y
1000
8
B(–1, 7)
7
1001 R (2, 6)1010
I2 6
5
4
0001 I1 0000 0010
3
A (–4, 2)
2
1
L(–3, 1)
0 x
–6 –5 –4 –3 –2 –1 1 2 3 4 5 6
Fig. 5.4.8
y2 -y1 7- 2 5
2. m = = =
x2 - x1 - 1 - ( - 4) 3
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 23 Windowing and Clipping
4 -1 3 (3, 6) D (7, 6) C
Line slope m = =
6-4 2
æ1ö (6, 4)
y B ,x = x 1 + ç ÷ (y B - y 1 ) Q
è mø
æ1ö
= x P + ç ÷ (2 - y p ) (3, 2) I (7, 2)
è mø A B
(4, 1)
2 2 14 P
= 4 +
3
( 2 - 1) = 4 + 3 = 3
Fig. 5.4.9
æ 14 ö
I = ( y B , x, y B ) = ç , 2÷
è 3 ø
Example 5.4.6 : Find the clipping co-ordinates to clip the line segment P1 P2 against the
window ABCD using Cohen Sutherland line clipping algorithm
P1 = (10, 30) and P2 = ( 80, 90) window ABCD - A (20, 20), B (90, 20),
C (90, 70) and D (20, 70).
Review Question
· A polygon is nothing but the collection of lines. Therefore, we might think that
line clipping algorithm can be used directly for polygon clipping. However, when
a closed polygon is clipped as a collection of lines with line clipping algorithm,
the original closed polygon becomes one or more open polygon or discrete lines as
shown in the Fig. 5.5.1. Thus, we need to modify the line clipping algorithm to
clip polygons.
· We consider a
polygon as a
closed solid area.
Hence after
clipping it should
remain closed. To
achieve this we
require an
(a) Before clipping (b) After clipping
algorithm that
Fig. 5.5.1 Polygon clipping done by line clipping algorithm
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 24 Windowing and Clipping
will generate additional line segment which make the polygon as a closed area.
· For example, in Fig. 5.5.2 the lines a - b, c - d, d - e, f - g, and h - i are added to
polygon description to make it closed.
a b c d
i
e
g f
(a) (b)
Fig. 5.5.2 Modifying the line clipping algorithm for polygon
a b
e d
· The output of the algorithm is a list of polygon vertices all of which are on the
visible side of a clipping plane. Such each edge of the polygon is individually
compared with the clipping plane.
V1' V2 V1
V1
V2
V1 – Outside V1 – Inside
V2 – Inside V2 – Inside
Save V'1 and V2 Save V2
(a) (b)
V2
V1
V1' V1
V2
V1 – Inside V1 – Outside
V2 – Outside V2 – Outside
Save V'1 Save nothing
(c) (d)
Fig. 5.5.5 Processing of edges of the polygon against the left window boundary
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 26 Windowing and Clipping
This is achieved by processing two vertices of each edge of the polygon around the
clipping boundary or plane. This results in four possible relationships between the edge
and the clipping boundary or plane. (See Fig. 5.5.5).
1. If the first vertex of the edge is outside the window boundary and the second
vertex of the edge is inside then the intersection point of the polygon edge with
the window boundary and the second vertex are added to the output vertex list
(See Fig. 5.5.5 (a)).
2. If both vertices of the edge are inside the window boundary, only the second
vertex is added to the output vertex list. (See Fig. 5.5.5 (b)).
3. If the first vertex of the edge is inside the window boundary and the second vertex
of the edge is outside, only the edge intersection with the window boundary is
added to the output vertex list. (See Fig. 5.5.5 (c)).
4. If both vertices of the edge are outside the window boundary, nothing is added to
the output list. (See Fig. 5.5.5 (d)).
· Once all vertices are processed for one clip window boundary, the output list of
vertices is clipped against the next window boundary.
· Going through above four cases we can realize that there are two key processes in
this algorithm.
1. Determining the visibility of a point or vertex (Inside - Outside test) and
2. Determining the intersection of the polygon edge and the clipping plane.
· One way of determining the visibility of a point or vertex is described here.
· Consider that two points A and B define the window boundary and point under
consideration is V, then these three points define a plane.
· Two vectors which lie in that plane are AB and AV. If this plane is considered in
the xy plane, then the vector cross product AV ´ AB has only a z component
given by (xV – xA) (yB – yA) – (yV – yA) (xB – xA).
· The sign of the z component decides the position of point V with respect to
window boundary.
If z is : Positive – Point is on the right side of the window boundary
Zero – Point is on the window boundary
Negative – Point is on the left side of the window boundary
Example 5.5.1 Consider the clipping boundary as shown in the Fig. 5.5.6 and determine the
positions of points V1 and V2.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 27 Windowing and Clipping
6
B(2,5)
4
V1(1,3)
V2(4,3)
2
A(2,1)
x
2 4 6 8
Fig. 5.5.6
The result of the cross product for V1 is negative hence V1 is on the left side of the
window boundary.
Using the cross product for V2 we get, (4 – 2) (5 – 1) – (3 – 1) (2 – 2)
= (2) (4) – 0
= 8
The result of the cross product for V2 is positive hence V1 is on the right side of the
window boundary.
The second key process in Sutherland - Hodgeman polygon clipping algorithm is to
determine the intersection of the polygon edge and the clipping plane. Any of the line
intersection (clipping) techniques discussed in the previous sections such as Cyrus-Beck
or mid point subdivision can be used for this purpose.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 28 Windowing and Clipping
5. Save the resulting intersections and vertices in the new list of vertices according to
four possible relationships between the edge and the clipping boundary discussed
earlier.
6. Repeat the steps 4 and 5 for remaining edges of the clipping window. Each time
the resultant list of vertices is successively passed to process the next edge of the
clipping window.
7. Stop.
Example 5.5.2 For a polygon and clipping window shown in Fig. 5.5.7 give the list of vertices
after each boundary clipping.
V4
Clipping window
V3
V5
V2
V1
Fig. 5.5.7
V4
Solution : Original polygon vertices are V1, V2, V3,
V'3 V'4
V4, V5. After clipping each boundary the new
vertices are given in Fig. 5.5.7 (a).
After left clipping : V1, V 1¢ , V 2¢ , V3, V4, V5
After right clipping : V1, V 1¢ , V 2¢ , V3, V4, V5 V3
After top clipping : V1, V 1¢ , V 2¢ , V3, V 3¢ , V 4¢ , V5 V'2
V5
After bottom clipping : V 2¢¢, V 2¢ , V3, V 3¢ , V 4¢ , V5,
V 5¢ V2
V'5
V''2
· The Sutherland-Hodgeman polygon clipping
V'1
algorithm clips convex polygons correctly,
V1
but in case of concave polygons, clipped
polygon may be displayed with extraneous Fig. 5.5.7(a)
lines, as shown in Fig. 5.5.8.
Computer Graphics 5 - 29 Windowing and Clipping
The algorithm describes both the subject and the Fig. 5.5.9
clip polygon by a circular list of vertices. The
boundaries of the subject polygon and the clip polygon may or may not intersect. If they
intersect, then the intersections occur in pairs. One of the intersections occurs when a
subject polygon edge enters the inside of
For subject polygon For clip polygon
the clip polygon and one when it leaves.
As shown in the Fig. 5.5.9, there are four
V1 C1
intersection vertices I1, I2 , I3 and I4. In
V2 I4
these intersections I1 and I3 are entering
Start I1 I3 Finish
intersections, and I2 and I3 are leaving
intersections. The clip polygon vertices are V 3 I2
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 30 Windowing and Clipping
direction (i.e. I1, V3, V4, I2). At the occurrence of leaving intersection the algorithm
follows the clip polygon vertex list from the leaving intersection vertex in the downward
direction (i.e. I2, I1). At the occurrence of the entering intersection the algorithm follows
the subject polygon vertex list from the entering intersection vertex. This process is
repeated until we get the starting vertex. This process we have to repeat for all
remaining entering intersections which are not included in the previous traversing of
vertex list. In our example, entering vertex I3 was not included in the first traversing of
vertex list,. Therefore, we have to go for another vertex traversal from vertex I3.
The above two vertex traversals gives two clipped inside polygons. There are :
I1, V3, V4, I2, I1 and I3, V6, I4, I3
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 31 Windowing and Clipping
Entering Leaving
intersection Inside
intersection
Inside
Bottom edge
Pi+1 Outside
Pi
First Pi+1
A intersection
intermediate intersections
Pi
C
Pi
B
Fig. 5.5.11 Entering and leaving intersections
The last intersection of the infinite line, L i , with a window edge represents a
transition from a visible to an invisible side of the window edge and is called a leaving
intersection. The two intermediate intersections can occur in either entering-leaving
order as illustrated by the lines A and C, or in leaving-entering order, as illustrated by
the line B in the Fig. 5.5.11.
If the intermediate intersections occur in entering leaving order, then the infinite line,
L i , intersects the window. However, the visibility of any part or all of the polygon edge,
Pi Pi + 1 , is depend on the location Pi+1
of Pi Pi + 1 along L i , as shown by
the polygon edges on lines A and Li+1
C in Fig. 5.5.11.
C Window
If the intermediate intersections
Turning
occur in leaving-entering order (as vertex
Pi
in case of line B), no part of the
infinite line, L i , is visible in the
window.
Turning Vertices A
Pi+2
If a subsequent polygon edge
reenters the window through a
different window edge, then it is Li+2
necessary to include one or more of
the window corners in the output B
polygon. This is illustrated in Fig. 5.5.12. Liang and Barsky call such a window corner a
turning vertex.
A necessary, but not sufficient, condition that a turning vertex exist if an entering
intersection occurs on Pi+ 1 Pi + 2 and outside the window as shown in the Fig. 5.5.12.
When this condition occurs, the Liang-Barsky polygon clipping algorithm adds the
turning vertex closest to the entering vertex to the output polygon. This is a necessary
but not sufficient condition, because, the entire polygon could lie outside the window.
Thus, extraneous turning vertices can be added to the output polygon. This is the main
drawback of the Liang-Barsky algorithm.
However, it is important to note that unless the first entering intersection is a
window corner and hence coincident with the second entering intersection, and thus that
the first entering intersection cannot be in the window, yields a sufficient condition for
including a turning vertex in the output polygon.
It is possible to calculate the actual intersections of the Line L i and the window
edges, as well as the ordering of the intersections by using the parametric equation of
the polygon edge.
P(t) = Pi + (Pi+ 1 - Pi ) t
where 0 < t £ 1 represents the polygon edge except for the
initial point, Pi , and
-¥ < t < ¥ represents the infinite line containing the
polygon edge
x = xi + ( xi + 1 - x i ) t = x i + Dxt
y = y i +( y i+ 1 - y i ) t = y i + Dyt
For a regular clipping region, the edges are given by,
x left £ x £ x right
y bottom £ y £ y top
Using subscripts e and l to denote entering and leaving intersections, the parametric
values for the four intersections with the window edges are
t xe = (x e - x i ) Dx i Dx i ¹ 0
t xl = (x l - x i ) Dx i Dx i ¹ 0
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 33 Windowing and Clipping
t ye = (y e - y i ) Dy i Dy i ¹ 0
t yl = (y l - y i ) Dy i Dy i ¹ 0
ì x left Dx i > 0
where xe = í
î x right Dx i £ 0
ìx Dx i > 0
x l = í right
î x left Dx i £ 0
ì y bottom Dy i > 0
ye = í
î y top Dy i £ 0
ìy Dy i > 0
y l = í top
î y bottom Dy i £ 0
The first and second entering and leaving intersections are given by
t e1 = min (t xe , t ye )
t e2 = max (t xe , t ye )
t l1 = min (t xl , t yl )
t l2 = max (t xl , t yl )
Let us observe the conditions that decides whether to contribute, not to contribute,
partly contribute, or to add turning vertex to the output polygon.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 34 Windowing and Clipping
The Table 5.5.2 summarizes the six output conditions for polygon edges.
1. 1 < te1 No
3. 0 ³ te2 and 0 ³ t l1 No
Algorithm
For each polygon edge P(i) P(i + 1)
· Determine the direction of the edge and find whether it is diagonal, vertical or
horizontal.
· Determine the order of the edge-window intersections.
· Determine the t-values of the entering edge-window intersections and the t-values
for the first leaving intersection.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 36 Windowing and Clipping
Example 5.5.3 Find clipping co-ordinates for a line p 1 p 2 using Liang-Barsky algorithm
where p 1 = (50, 25) and p 2 = (80, 50), against window with ( xw min , y w min ) = (20, 10)
and ( xw max , y w max ) = (70, 60).
Solution : x 1 = 50, y 1 = 25, x 2 = 80, y 2 = 50
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 37 Windowing and Clipping
q 1 p 1 = 30/–30 = – 1.000
q 2 p 2 = 20/30 = 0.667
q 3 p 3 = 15/–25 = – 0.600
q 4 p 4 = 35/25 = 1.400
90
80
70
(xwmax, ywmax)
60
p2 = (80, 50)
50
30 p1 = (50, 25)
20 (xx1, yy1)
10
(xwmin, ywmin)
0
10 20 30 40 50 60 70 80 90
Fig. 5.5.16
Example 5.5.4 Find clipping co-ordinates for a line AB, where A = (5, 20) and B = (30, 30).
Co-ordinates of window are : ( xw min , y w min ) = (15, 15) and ( xw max , y w max ) = ( 45, 45).
Solve using Liang-Barsky line clipping algorithm.
Solution : x 1 = 5, y 1 = 20, x 2 = 30, y 2 = 30
p 1 = – (x 2 - x 1 ) = – (30 – 5) = – 25
p 2 = (x 2 - x 1 ) = (30 – 5) = 25
p 3 = – (y 2 - y 1 ) = – (30 – 20) = – 10
p 4 = (y 2 - y 1 ) = (30 – 20) = 10
q 1 = (x 1 - x min ) = (5 – 15) = – 10
q 2 = (x max - x 1 ) = (45 – 5) = 40
q 3 = (y 1 - y min ) = (20 – 15) = 5
q 4 = (y max - y 1 ) = (45 – 20) = 25
q 1 p 1 = – 10/– 25 = 0.400
q 2 p 2 = 40/25 = 1.600
q 3 p 3 = 5/– 10 = – 0.500
q 4 p 4 = 25/10 = 2.500
50
(xwmax, ywmax)
40
B = (30, 30)
30
(xx2, yy2)
(xwmin, ywmin)
10
0
10 20 30 40 50
Fig. 5.5.17
Examples for Practice
Example 5.5.5 : Find clipping co-ordinates for a line AB, where A = (1, 3) and B = (5, 12).
Co-ordinates of window are : ( xw min , y w min ) = (2, 1) and
( xw max , y w max ) = (9, 10). Solve using Liang-Barsky line clipping
algorithm.
Example 5.5.6 : Find clipping co-ordinates for a line p 1 p 2 using Liang-Barsky algorithm
where p 1 = (90, 20) and p 2 = (20, 90), against window with
( xw min , y w min ) = (10, 10) and ( xw max , y w max ) = (60, 60).
Example 5.5.7 : Find clipping co-ordinates for a line p 1 p 2 using Liang-Barsky algorithm
where p 1 = (60, 20) and p 2 = (110, 40), against window with
( xw min , y w min ) = (30, 10) and ( xw max , y w max ) = (90, 50).
Example 5.5.8 : Find clipping co-ordinates for a line p 1 p 2 using Liang-Barsky algorithm
where p 1 = (5, –3) and p 2 = (3, 4), against window with
( xw min , y w min ) = (–1, 2) and ( xw max , y w max ) = (6, 5).
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 40 Windowing and Clipping
Review Questions
1. Can line clipping algorithm be used for polygon clipping ? Justify ? SPPU : Dec.-05, Marks 8
2. Describe Sutherland - Hodgeman polygon clipping algorithm with example.
SPPU : Dec.-06, 07, 08, 11, 14,17, 18, May-10, 14, Marks 8
Review Question
1. Explain the concept of generalized clipping with the help of suitable example.
SPPU : Dec.-07, 11, 12, May-09, Marks 8
· So far we have discussed only algorithms for clipping point, line and polygon to
the interior of a clipping region by eliminating every thing outside the clipping
region. However, it is also possible to clip a point, line or polygon to the exterior
of a clipping region, i.e., the point, portion of line and polygon which lie outside
the clipping region. This is referred to as exterior clipping.
· Exterior clipping is important in a multiwindow display environment, as shown in
Fig. 5.7.1.
· Fig. 5.7.1 shows the overlapping windows with window 1 and window 3 having
priority over window 2. The objects within the window are clipped to the interior
of that window.
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge
Computer Graphics 5 - 41 Windowing and Clipping
Window 2
Window 1 Window 3
Review Question
1. What is interior and exterior clipping. SPPU : May-05, 13, Dec.-05, 12, Marks 4
qqq
®
TECHNICAL PUBLICATIONS - An up thrust for knowledge