Presentation is loading. Please wait.

Presentation is loading. Please wait.

Two-Dimensional Viewing

Similar presentations


Presentation on theme: "Two-Dimensional Viewing"— Presentation transcript:

1 Two-Dimensional Viewing
Example: Graphic program which draw an entire building by an architect but we only interested on the ground floor Map of sales for entire region but we only like to know from certain region of the country. 1

2 Two-Dimensional Viewing
When we interested to display certain portion of the drawing, enlarge the portion, windowing technique is used Technique for not showing the part of the drawing which one is not interested is called clipping An area on the device (ex. Screen) onto which the window will be mapped is called viewport. Window defines what to be displayed. A viewport defines where it is to be displayed. Most of the time, windows and viewports are usually rectangles in standard position(i.e aligned with the x and y axes). In some application, others such as general polygon shape and circles are also available However, other than rectangle will take longer time to process. 2

3 Viewing Transformation
Viewing transformation is the mapping of a part of a world- coordinate scene to device coordinates. In 2D (two dimensional) viewing transformation is simply referred as the window-to-viewport transformation or the windowing transformation. Mapping a window onto a viewport involves converting from one coordinate system to another. If the window and viewport are in standard position, this just involves translation and scaling. if the window and/or viewport are not in standard, then extra transformation which is rotation is required. 3

4 Viewing Transformation
y-world y-view window window 1 x-view 1 x-world world Normalised device 4

5 Window-To-Viewport Coordinate Transformation
Window-to-Viewport transformation 5

6 Window-To-Viewport Coordinate Transformation
. YWmax YVmax xw,yw xv,yv YWmin YVmin XVmin XVmax XWmin XWmax 6

7 Window-To-Viewport Coordinate Transformation
xv - xvmin = xw - xwmin xvmax - xvmin xwmax - xwmin yv – yvmin = yw - ywmin yvmax – yvmin ywmax - ywmin From these two equations we derived xv = xvmin + (xw – xwmin)sx yv = yvmin + (yw – ywmin)sy where the scaling factors are   sx = xvmax – xvmin sy = yvmax - yvmin xwmax – xwmin ywmax - ywmin 7

8 The sequence of transformations are:
Window-To-Viewport Coordinate Transformation The sequence of transformations are: 1. Perform a scaling transformation using a fixed-point position of (xwmin,ywmin) that scales the window area to the size of the viewport. 2. Translate the scaled window area to the position of the viewport. 8

9 Window-To-Viewport Coordinate Transformation
Relative proportions of objects are maintained if the scaling factors are the same (sx = sy). Otherwise, world objects will be stretched or contracted in either x or y direction when displayed on output device. How about character strings when map to viewport? maintains a constant character size (apply when standard character fonts cannot be changed). If character size can be changed, then windowed will be applied like other primitives. For characters formed with line segments, the mapping to viewport is carried through sequence of line transformations . 9

10 Viewport-to-Normalized Device Coordinate Transformation
From normalized coordinates, object descriptions can be mapped to the various display devices When mapping window-to-viewport transformation is done to different devices from one normalized space, it is called workstation transformation. 10

11 The Viewing Pipeline 11


Download ppt "Two-Dimensional Viewing"

Similar presentations


Ads by Google