Professional Documents
Culture Documents
VIEWING
Computer Engineering
Kocaeli University
Model
Model
Model
M1
M2
M3
3D World
Scene
3D View
Scene
V
P Clip Normalize
2D/3D Device
Scene
2D Image
Projection
Rasterization
Modeling
Transformations
Viewing
Transformations
MCS
WCS VCS
NDCS
DCS
SCS
Viewing Pipeline Revisited
Model - World
Model coordinates to World coordinates:
Modelling transformations
Model coordinates:
1 circle (head),
2 circles (eyes),
1 line group (nose),
1 arc (mouth),
2 arcs (ears).
With their relative
coordinates and sizes
World coordinates:
All shapes with their
absolute coordinates and sizes.
circle(0,0,2)
circle(-.6,.8,.3) circle(.6,.8,.3)
lines[(-.4,0),(-.5,-.3),(.5,.3),(.4,0)]
arc(-.6,0,.6,0,1.8,180,360)
arc(-2.2,.2,-2.2,-.2,.8,45,315)
arc(2.2,.2,2.2,-.2,.8,225,135)
World - Viewing
World coordinates to Viewing coordinates:
Viewing transformations
World coordinates Viewing coordinates:
Viewers position and view
angle. i.e. rotated/translated
View - Device
Projection: 3D to 2D. Clipping depends on
viewing frame/volume. Normalization: device
independent coordinates
Device Independent Coordinates:
Invisible shapes deleted, others
reduced to visible parts.
3 arcs, 1 circle, 1 line group
Viewing coordinates:
Device Independen Coordinates Screen or
Device Coordinates
Device Independent Coordinates to Device
Coordinates. Rasterization
Unit measures Pixels
Device Independent
Coordinates
Screen Coordinates or
Device Coordinates
2D Viewing
World coordinates to Viewing coordinates
Window to Viewport.
Window: A region of the scene selected for viewing
(also called clipping window)
Viewport: A region on display device for mapping to
window
World Coordinates
Viewing Coordinates
Window
Viewport
Clipping Window vs. Viewport
The clipping window selects what we want
to see in our virtual 2D world.
The viewport indicates where it is to be
viewed on the output device (or within the
display window)
By default the viewport have the same
location and dimensions of the GLUT display
window you create
But it can be modified so that only a part of
the display window is used for OpenGL display
The clipping window
xw
min
xw
max
yw
min
yw
max
xv
min
xv
max
yv
min
yv
max
xv
min
xv
max
yv
min
yv
max
x
0
y
0
x
view
y
view
x
world
y
world
x
view
y
view
Rectangular
Window
Rotated
Window
Transformations Between
Coordinates Systems
Rule: Transform one coordinate frames towards
the other in the opposite direction of the
representation change.
Transformations Between Coordinates
Systems
Two Steps:
1. Translate so that the origin (x
0
,y
0
) of the xy
system is moved to the origin of the xy system.
2. Rotate the x axis onto the x axis.
Transformations Between Coordinates
Systems
(
(
(
=
1 0 0
1 0
0 1
) , (
0
0
0 0
y
x
y x T
(
(
(
=
1 0 0
0 cos sin
0 sin cos
) ( R
) , ( ) (
0 0
y x
y x xy
=
' '
T R M
World-coordinates to Viewing Coordinates
M
wc,vc
= RT
x
0
y
0
x
view
y
view
x
world
y
world
x
view
y
view
x
view
y
view
x
world
y
world
y
view
) , (
0 0
y x T ) (u R
u
Coordinate Representation
Normalized Coordinates: A graphic system first converts world
coordinate positions to normalized device coordinates, in the range
0 to 1.This makes the system independent of the output-devices.
An initial modeling coordinate position is transferred to a device
coordinate position with the sequence
The modeling and world coordinate positions in this
transformation can be any floating values; normalized coordinates
satisfy the inequalities
) , ( ) , ( ) , ( ) , (
dc dc nc nc wc wc mc mc
y x y x y x y x
1 0 s s
nc
x 1 0 s s
nc
y
Normalization
Calculating Device Coordinates
Coordinate transformation:Different sizes and/or height width
ratios?
For any point:
should hold. And;
min max
min
min max
min
min max
min
min max
min
yw yw
yw yw
=
yv yv
yv yv
xw xw
xw xw
=
xv xv
xv xv
( )
( )
( )
( )
min max
min max
min min
min max
min max
min min
yw yw
yv yv
yw yw + yv = yv
xw xw
xv xv
xw xw + xv = xv