Download presentation
Presentation is loading. Please wait.
1
11. Viewing Transformations
ME 521 Computer Aided Design 11. Viewing Transformations Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze Technical University
2
Mechanical Engineering Department, GTU
Introduction 11. Viewing Transformations In engineering the picture coordinates are in inches, meters, etc. but the screen coordinates are e.g The screen coordinates are difficult to work with since they are integers and also when zooming or panning the range is not enough. This can be avoided if the picture can be defined in world coordinates or page coordinates and through the viewing transformations these can be expressed in screen coordinates. 2-D viewing transformations would allow scaling, rotation and translation. The transformed picture would be clipped and visible portion would be added to the display file. The transformation generally without the rotation part is known as windowing transformation. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
3
Mechanical Engineering Department, GTU
Viewport 11. Viewing Transformations Viewport (Screen Window): A clipping algorithm permits the boundaries of the clipping region to be set anywhere on the screen. This is a very useful feature. It allows us to display the picture in a rectangle smaller than the screen, thus leaving blank areas in which to display messages, command menus and etc. A rectangular region such as this, is called a viewport. It is possible to clip several different pictures to different viewports and display them simultaneously on the screen. Viewport is associated with screen. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
4
Mechanical Engineering Department, GTU
Windows 11. Viewing Transformations WINDOWS: Process of preparing a transformed picture for display takes place in two steps: a) Transformation into screen coordinates b) Clipping to the viewport boundary This is wasteful in time if carried out in this order, since we may find that most of the lines lie outside of the screen. It is better to distinguish lines before transforming them. This is done by clipping to the window, which is the image of the viewport in the coordinates of the picture before transformation. Window is always another four-sided region; it is always the same shape as the viewport provided the picture is scaled by the same amount in x and y. If no rotation is applied, the window like the viewport has its edges parallel to the axes. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
5
Mechanical Engineering Department, GTU
Windows 11. Viewing Transformations When rotated information has to be clipped, we apply clipping using the viewport as the clipping region, or after transformation. Unrotated pictures on the other hand are clipped before transformation, using the window. World or Page coordinates - original definition of space Screen coordinates - final definition of space Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
6
Mechanical Engineering Department, GTU
Windowing Transformations 11. Viewing Transformations Window and viewport are often more convenient to use than scale and translation in defining the transformation from page to screen. e.g. If a large picture is to be examined, viewport or window size is kept fixed, and the window position is moved, this allows us to scan the picture at a fixed magnification. Fixing the window center and varying its size changes the magnification. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
7
Mechanical Engineering Department, GTU
Windowing Transformations 11. Viewing Transformations Assume entire screen as viewport. Choose window with center at (Wcx , Wcy) in the page coordinate system. Size of window measured from the center is Wsx , Wsy . The equations defining the transformation of a point (Xp , Yp) in the page to a point (Xs , Ys) on the screen are: so Xs and Ys are unitless and are (-1) to (1). If viewport is less than the screen and has a center at (Vcx , Vcy) and the size is Vsx x Vsy , measuring the size from the center and expressing all in screen coordinates. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
8
Mechanical Engineering Department, GTU
Windowing Transformations 11. Viewing Transformations Then the point (Xp , Yp ) in page coordinates maps into the following point in screen coordinates: Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
9
Mechanical Engineering Department, GTU
Windowing Transformations 11. Viewing Transformations Alternative Windowing Transformation: Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
10
Mechanical Engineering Department, GTU
Windowing Transformations 11. Viewing Transformations For efficiency the above equations can be reduced to: a, b, c, d are precalculated and each point is then processed using these equations. Dr. Ahmet Zafer Şenalp ME 521 Mechanical Engineering Department, GTU
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.