You are on page 1of 11

WINDOW TO VIEWPORT

TRANSFORMATION
Presented By:
Mohammed Hisham
042
042

A Window is a rectangular region that surrounds
that portion of the image that we wish to have
displayed
The window follows real world coordinate
system (centered around the origin)
Specified as (x,y) coordinates
WINDOW
x
y
-3
-2
-1
0
1
2
3
-4 -3 -2 -1 1 2 3 4
Window (world)
(x
min
, y
min
)
(x
max
, y
max
)
The area on the screen where we wish to map the
window
Specified in screen coordinates -
(u,v)coordinates
The viewport can take up the entire screen, or just
a portion of it
VIEWPORT
u
v
0 10 20 30 40 50 60 70 80
10
20
30
40
50
60
0
Viewport (screen)
(u
min
, v
min
)
(u
max
, v
max
)
WINDOW-TO-VIEWPORT TRANSFORMATION
A Window-to-Viewport Transformation is a geometric
transformation which maps an image from a real world
window to a region of a display (viewport)

Need for transformation:
1)Coordinate system of window and viewport is different

2)The size of the viewport might be smaller or larger
than the window.

USE OF 2D TRANSFORMATIONS FOR
WINDOW TO VIEWPORT MAPPING

Define Window Viewport


The inputs to this transformation are
window-size and viewport-size.

WINDOW
x
min
x
max
y
min
y
max
u
min
u
max
v
min
v
max
0,0
0,0
FOLLOWING STEPS ARE TAKEN TO TRANSFORM
WINDOW TO VIEWPORT
1)Translate window to origin


tx= -x
min

ty= -y
min

1 0 0
0 1 0
x
min
-y
min
1
0,0
2)SCALE WINDOW TO VIEW PORT SIZE
Sx = length of viewport Sy = Width of Viewport
length of window Width of Window
u
max
u
min
0 0
x
max
x
min
0 v
max
v
min
0
y
max
y
min
0 0 1
Sx

Sy
Scaling
3)TRANSLATE TO LOWER LEFT CORNER OF VIEWPORT
TO GET DESIRED IMAGE ON VIEWPORT
tx= u
min
ty = v
min
1 0 0

0 1 0

u
min
v
min
1
VIEWPORT
u
min
v
min
FINAL WINDOW TO VIEWPORT TRANSFORM
IS
M
wv
= T(-x
min
,-y
min
) * S (S
x
,S
y
) * T(u
min
,v
min
)

1 0 0

0 1 0

-x
min
-y
min
1
Sx 0 0
0 Sy 0
0 0 1


1 0 0

0 1 0

u
min
v
min
1
S
x
0 0
0 S
y
0
-x
min
S
x
+ u
min
-y
min
S
y
+ v
min
1


Where S
x
= u
max
u
min
S
y
= v
max
v
min

x
max
x
min
y
max
y
min


=

You might also like