You are on page 1of 12

Window and Clipping

An architect may have a graphics programs to draw an entire building but we interested in only the ground floor. Windowing The method for selecting the portion of a drawing is called windowing Clipping The technique of hiding that part of the drawing which one is not interested in is called clipping.

Viewing transformation
Window to view only part of an object

View port : the part of the screen

View port

Changing the window size to become the size of the view port ( scaling ) , We are positioning it at the desired location of the screen ( translating )

World coordinate system

Device coordinate system

World coordinate system It is the Cartesian coordinate system in whose coordinate is to describe the picture that is to be displayed.
Device coordinate system ( DCS ) Device coordinate system is the coordinate system that corresponds to the device or workstation where the image of the picture or model is to be displayed.

Windows and View Ports: The problem faced with the WCS is theoretically infinite in extent while the device display area is finite. To perform a viewing transformation with a finite region in WCS is called window. The window can be mapped directly onto the display area of the device onto a sub region of the display called view port.
Window to view port mappeingA point at a position ( Xw, Yw ) in the window is mapped into position ( Xv, Yv ) in the associated view port. To maintain the same relative placement in the view port as in the window require that

After solving above expression for view port position ( Xv, Yv ) Xv = Xvmin + ( Xw Xwmin ) sx Yv = Yvmin + ( Yw Ywmin ) sy Scaling factor are :

Aspect ratio Viewing transformation involves scaling, undesirable distortions may introduced whenever sx =! Sy For e.g. Circles within the window may be avoided, the concept of aspect ratio is needed. may be displayed as a ellipses, squares and rectangles.
The aspect ratio of rectangular window or viewport is defined by a = ( Xmax Xmin ) ( Ymax Ymin )

If the aspect ratio aw of the window equals the aspect ratio a of view port them sx = sy and no distortion.

Clipping We want to display only a portion of the total picture. In this case a window is used to select that portion of the picture which is to be viewed. This is known as clipping. The process of clipping determines which elements of the picture lie inside the window are visible.
Shielding It is a reverse of clipping. Covering up a portion of the picture so that it is not visible.

Rectangular clipping window : We assume that our window is rectangle whose size are aligned with the coordinate axes. x extent is measured from Xmin to Xmax. y extent is measured from Ymin to Ymax Point Clipping : A point P(x,y) is inside the window ( visible ) if all the following inequalities are true. X <= Xmax X >= Xmin Y <= Ymax Y >= Ymin

Viewing in 2D


Window in world coordinates.

Viewport in Device coords

250 x 250 Pixels.