Docsity

Computer Graphics 2-D VIEWING, Essays (university) of Computer Graphics

Toggle sidebar
bg1
MECH – III R16 COMPUTER GRAPHICS - I Y.N.D.Aravind
1
WINDOWING TRANSFORMATIONS
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:
pf3
pf4
pf5
pf8

Partial preview of the text

Download Computer Graphics 2-D VIEWING and more Essays (university) Computer Graphics in PDF only on Docsity!

WINDOWING TRANSFORMATIONS

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:

Sutherland-Hodgman Algorithm

A polygon is a closed surface without any curvature. The standard polygon are square, rectangle,

parallelogram, etc.

The first and foremost thing what we need to do here is to define a window with specified boundaries.

There are four steps in this algorithm

The output of one step may be given as input of other step.

Liang-Barsky Line Clipping Algorithm

Here we will give a time interval between the starting point and ending point, based on the time interval we

will calculate the intersepcting point.

So if we consider to points (x 1 , y 1 ) and (x 2 , y 2 ), stating with time interval t = 0 and time taken to reach the

end point t =1.

Let the line intersecting the window at time interval t. where 0 t 1 so let us find (x, y) at time interval t.

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

  • t x  x 1 - xwmin t x  xwmax - x 1
  • t y  y 1 - ywmin t y  ywmax - y 1 based on the four conditions we can find whether the given line is inside or outside the window let us compare with tpk  qk, k=1, 2, 3, 4 where the parameters p and q are defined as: p 1 = – x, q 1 = x 1 – xwmin p 2 = x, q 2 = xwmax – x 1 p 3 = – y, q 3 = y 1 – ywmin p 4 = y, q 4 = ywmax – y 1

 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