You are on page 1of 13

Shri P. M.

Agrawal
Shri V. J. Patel
A world-coordinate area selected for display is called
a window.
An area on display 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.
The mapping of a part of a world-coordinate scene to The mapping of a part of a world-coordinate scene to
device coordinates is referred to as a viewing
transformation.
Sometimes the 2D viewing transformation is simply
referred to as the window-to-viewport
transformation or the windowing transformation.
But, in general, viewing involves more than just the
transformation from the window to the viewport.
2/9/2011 2 P.M.Agrawal & V.J.Patel
Fig 5.1 illustrates the window-to-viewport
mapping. A point at position (xw, yw) in the
window is mapped into position (xv, yv) in the
associated viewport.
To maintain same relative placement in the To maintain same relative placement in the
viewport as in the window we require that
2/9/2011 P.M.Agrawal & V.J.Patel 3
2/9/2011 P.M.Agrawal & V.J.Patel 4
Solving these equations for the viewport
postion (xv, yv), we have
xv = xv
min
+ (xw xw
min
)sx
yv = yv
min
+ (yw yw
min
)sy 5.1
Where the scaling factors are Where the scaling factors are
2/9/2011 P.M.Agrawal & V.J.Patel 5
Equation 5.1 can also be derived with a set of
transformations that converts the window area in to
the viewport area. This conversion is performed with
the following sequence of transformations:
1. Perform a scaling transformation using fir-point position
of (xw
min
, yw
min
) that scales the window are to the size of
the viewport. the viewport.
2. Translate the scaled window area to the position of the
viewport.
Relative proportions of objects are maintained if the
scaling factors are the same (sx = sy). Otherwise,
world objects will be stretched or contracted in
wither the x or y direction when displayed on the
output device.
2/9/2011 P.M.Agrawal & V.J.Patel 6
Generally, any procedure that identifies those
portions of a picture that are either inside or
outside of a specified region of space is
referred to as clipping algorithm or simply
clipping. The region against which an object clipping. The region against which an object
is to clipped is called a clip window.
Point clipping
Line clipping
Area clipping (polygon)
Curve clipping
Text clipping
2/9/2011 P.M.Agrawal & V.J.Patel 7
Assuming that the clip window is a rectangle in
standard position, we save a point P = (x, y) for
display if the following inequalities are satisfied:
xw
min
x xw
max
yw
min
y yw
max
where the edges of the clip window (xwmin, where the edges of the clip window (xwmin,
xwmax, ywmin, ywmax) can either the world-
coordinate window boundaries or viewport
boundaries.
If any one of these four inequalities is not
satisfied, the point is clipped (not saved for
display).
2/9/2011 P.M.Agrawal & V.J.Patel 8
2/9/2011 P.M.Agrawal & V.J.Patel 9
2/9/2011 P.M.Agrawal & V.J.Patel 10
2/9/2011 P.M.Agrawal & V.J.Patel 11
2/9/2011 P.M.Agrawal & V.J.Patel 12
2/9/2011 P.M.Agrawal & V.J.Patel 13

You might also like