Announcements Two-Dimensional Viewing
Computer Graphics
Autumn 2009
CS4815
Announcements Two-Dimensional Viewing
Outline
Announcements
Two-Dimensional Viewing Two-Dimensional Viewing Pipeline
CS4815
Announcements Two-Dimensional Viewing
Announcements
Extra lecture: 16.00, Thursday, Week07, Room CS-G25 Mid-term: 13.00, Friday, Week07 No lecture Mon. Week08 Today, 16th Oct. Hamiltons Day
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Outline
Announcements
Two-Dimensional Viewing Two-Dimensional Viewing Pipeline
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Coordinate Systems
Several coordinate systems used in graphics systems. World coordinates are the units of the scene to be modelled; we select a window of this world for viewing Viewing coordinates are where we wish to present the view on the output device; we can achieve zooming by mapping different sized clipping windows to a xed-size viewport; can have multiple viewports
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Coordinate Systems
Several coordinate systems used in graphics systems. World coordinates are the units of the scene to be modelled; we select a window of this world for viewing Viewing coordinates are where we wish to present the view on the output device; we can achieve zooming by mapping different sized clipping windows to a xed-size viewport; can have multiple viewports
Clipping Window Viewport (possibly different size)
Viewport Coordinates
World Coordinates
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Coordinate Systems
Several coordinate systems used in graphics systems. World coordinates are the units of the scene to be modelled; we select a window of this world for viewing Viewing coordinates are where we wish to present the view on the output device; we can achieve zooming by mapping different sized clipping windows to a xed-size viewport; can have multiple viewports
Clipping Window Viewport (different size)
Viewport Coordinates
World Coordinates
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Coordinate Systems (contd.)
The clipping window selects what; the viewport indicates where on output device Normalized coordinates are introduced to make viewing process independent of any output device (paper vs. mobile phone); clipping normally and more efciently done in these coordinates Device coordinates are specic to output device: printer page, screen display, etc. The Viewing Pipeline.
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Coordinate Systems (contd.)
The clipping window selects what; the viewport indicates where on output device Normalized coordinates are introduced to make viewing process independent of any output device (paper vs. mobile phone); clipping normally and more efciently done in these coordinates Device coordinates are specic to output device: printer page, screen display, etc. The Viewing Pipeline.
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Coordinate Systems (contd.)
The clipping window selects what; the viewport indicates where on output device Normalized coordinates are introduced to make viewing process independent of any output device (paper vs. mobile phone); clipping normally and more efciently done in these coordinates Device coordinates are specic to output device: printer page, screen display, etc. The Viewing Pipeline.
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Coordinate Systems (contd.)
The clipping window selects what; the viewport indicates where on output device Normalized coordinates are introduced to make viewing process independent of any output device (paper vs. mobile phone); clipping normally and more efciently done in these coordinates Device coordinates are specic to output device: printer page, screen display, etc.
Construct World Coordinate Scene
Convert World Coords. to Viewing Coords.
Viewing Coords. are Normalized
Map Normalized Coords. to Device Coords.
The Viewing Pipeline.
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Viewing-Coordinate Clipping Window
Given a scene in world coordinates, how do we transform a point w = (wx , wy ) to viewing coordinates v = (vx , vy ) for clipping, etc.?
y (world)
Clipp in
g win dow
x (world)
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Viewing-Coordinate Clipping Window
Given a scene in world coordinates, how do we transform a point w = (wx , wy ) to viewing coordinates v = (vx , vy ) for clipping, etc.?
y (vie
y (world)
w)
x (vie
a
w)
x (world)
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Viewing-Coordinate Clipping Window (contd.)
If the view coordinate system is located at (a, b) we rstly translate it back to the world origin by subtracting the view-up vector, V = (a, b) The angle, , that V makes with the y -world axis is what w must be rotated by to transform it in to viewing coordinates Then the composite transformation MW ,V to make this transformation from w (world) to v (viewport) is v = MW ,V w where MW ,V = R T Translate rst, then Rotate cos sin 0 1 0 a = sin cos 0 0 1 b 0 0 1 0 0 1
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Normalization and Viewport Transformations
In some graphics systems normalization and window-to-viewport transformations are combined in to one operation In this case axes of viewport coord. system are often given in range of [0, 1] After clipping, the square is mapped to the output display As an alternative, in other systems normalization and clipping are applied before viewport transformations In these systems, the viewport boundaries are specied in screen coords relative to the display-window position What both systems have in common is a need to map a point (x, y ) in one rectangle to (x , y ) in another
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Normalization and Viewport Transformations (contd.)
Cy Clipping Window Ny
(x,y) (x,y)
Normalization Window
ny
cy c
x
Cx
nx
Nx
What is transformation that maps (x, y ) within, say, the clipping window to (x , y ) in, say, a normalised window? In order to maintain the same relative position x nx x cx = Nx nx Cx cx y ny y cy = Ny ny Cy cy
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Normalization and Viewport Transformations (contd.)
After solving for (x , y ) we get... x = sx x + tx y = s y y + ty
The scalings, sx and sy are sx = Nx nx , Cx cx sy = Ny ny Cy cy
The translation factors are tx = Cx nx cx Nx C x cx ty = Cy ny cy Ny Cy cy
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Normalization and Viewport Transformations (contd.)
So we get a composite transformation, MC,N that combines a translation and a scaling MC,N = T S sx 0 = 0 sy 0 0
tx ty 1
CS4815
Announcements Two-Dimensional Viewing
Two-Dimensional Viewing Pipeline
Normalization and Viewport Transformations (contd.)
This expression holds for any mapping from one rectangular coordinate system to another Whether the clipping window to viewport transformation is done in one step or in two, the same procedure for determining the transformation matrix can be used For example, if we map from the clipping window to a normalized square [1, 1] [1, 1], (then clip in this square and then convert to screen coords) the rst transformation matrix of this pipeline is 2 Cx +cx 0 Cx cx C c x x Cy +cy 2 MC,NS = 0 Cy cy Cy cy 0 0 1
CS4815