




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Window : A world coordinate area selected for display (i.e. area of picture selected for viewing). What to be displayed. Viewport : An Area or a display device to which a window is mapped. Where to be displayed.
Note: Window defines what is to be viewed and viewpoint defines where it is to be displayed. Often window and viewpoints are rectangles in standard position with edges parallel to coordinate axes. Generalised shapes like polygon etc., take long to process, so we are not considering these cases where window or viewport can have general polygon shape or circular shape.
The mapping of a part of a world coordinate scene to device coordinates is referred to as Viewing Transformation. In
general 2D viewing transformations are referred to as window to viewport transformation or windowing
transformation.
You may notice in Figure 15 , that all parts of the picture that lie outside the window are clipped and the contents which lie inside the widow are transferred to device coordinates. Secondly, you may also notice that while window selects a part of the scene, viewport displays the selected part at the desired location on the display area. When window is changed we see a different part of the scene at the same portion (viewport) on display. If we change the viewport only, we see the same part of the scene drawn at a different scale or at a different place on the display. By successively increasing or decreasing the size of the window around a part of the scene the viewport remain fixed, we can get the effect of zoom out or zoom in respectively on the displayed part. Mathematically, viewing transformation can be expressed as V=W.N
Where, V refers Viewing transformation which maps a part of world coordinate scene to device coordinates; W refers to workstation transformation which maps normalised device coordinates to physical device coordinates; N refers to Normalisation transformation used to map world coordinates to normalized device coordinates.
Window to Viewpoint Coordinates transformation:
Liang-Barsky Line Clipping Algorithm
For a line segment with endpoints (x 1 , y 1 ) and (x 2 , y 2 ), we can describe the line with parametric form: x = t x 2 + ( 1 – t ) x 1 = t x 2 + x 1 – t x 1 = x 1 + t (x 2 - x 1 )
x = x 1 + t x y = y 1 + t y, 0 t 1 where x= x 2 – x 1 and y= y 2 – y 1
we know that according to the point clipping algorithm xwmin x xwmax ywmin y ywmax
substituting x and y values xwmin x 1 + t x xwmax ywmin y 1 + t y ywmax
by this we get four conditions x 1 + t x ≥ xwmin x 1 + t x xwmax y 1 + t y ≥ ywmin y 1 + t y ywmax
Each of these four inequalities can be expressed as: tpk qk, k=1, 2, 3, 4
If pk=0 the line is parallel to the window and if qk < 0 the line is out side. If qk > 0 the line is inside or partially inside. If qk = 0 the line is with in the boundary or partially on the boundary.
If pk < 0, the infinite extension of the line proceeds from the outside to the inside of the infinite extension of this clipping boundary. pk--> t 1 where t 1 max ( 0, qk / pk)
if t 1 = 0 then x = x 1 + t 1 x y = y 1 + t 1 y, If pk pk--> t 2 where t 2 min ( 1, qk / pk) if t 2 = 0 then x = x 1 + t 2 x y = y 1 + t 2 y