# Introduction to Computer Graphics - PowerPoint PPT Presentation

1 / 19
Title:

## Introduction to Computer Graphics

Description:

### Title: Introduction to Computer Graphics Author: Siva Kumar Description: ll product. Last modified by: masyura Created Date: 2/24/2000 11:52:41 AM Document ... – PowerPoint PPT presentation

Number of Views:505
Avg rating:3.0/5.0
Slides: 20
Provided by: SivaK4
Category:
Tags:
Transcript and Presenter's Notes

Title: Introduction to Computer Graphics

1
Introduction to Computer Graphics
• Chapter 6 2D Viewing Pt 1

2
Two-Dimensional Viewing
• Co-ordinate Systems.
• Cartesian offsets along the x and y axis from
(0.0)
• Polar rotation around the angle ?.
• Graphic libraries mostly using Cartesian
co-ordinates
• Any polar co-ordinates must be converted to
Cartesian co-ordinates
• Four Cartesian co-ordinates systems in computer
Graphics.
• 1. Modeling co-ordinates
• 2. World co-ordinates
• 3. Normalized device co-ordinates
• 4. Device co-ordinates

3
Modeling Coordinates
• Also known as local coordinate.
• Ex where individual object in a scene within
separate coordinate reference frames.
• Each object has an origin (0,0)
• So the part of the objects are placed with
reference to the objects origin.
• In term of scale it is user defined, so,
coordinate values can be any size.

4
World Co-ordinates.
• The world coordinate system describes the
relative positions and orientations of every
generated objects.
• The scene has an origin (0,0).
• The object in the scene are placed with reference
to the scenes origin.
• World co-ordinate scale may be the same as the
modeling co-ordinate scale or it may be
different.
• However, the coordinates values can be any size
(similar to MC)

5
Normalized Device Co-ordinates
• Output devices have their own co-ordinates.
• Co-ordinates values
• The x and y axis range from 0 to 1
• All the x and y co-ordinates are floating point
numbers in the range of 0 to 1
• This makes the system independent of the various
devices coordinates.
• This is handled internally by graphic system
without user awareness.

6
Device Co-ordinates
• Specific co-ordinates used by a device.
• Pixels on a monitor
• Points on a laser printer.
• mm on a plotter.
• The transformation based on the individual device
is handled by computer system without user
concern.

7
Two-Dimensional Viewing
• Example
• Graphic program which draw an entire building by
an architect but we only interested on the ground
floor
• Map of sales for entire region but we only like
to know from certain region of the country.

8
Two-Dimensional Viewing
• When we interested to display certain portion of
the drawing, enlarge the portion, windowing
technique is used
• Technique for not showing the part of the drawing
which one is not interested is called clipping
• An area on the device (ex. Screen) onto which the
window will be mapped is called viewport.
• Window defines what to be displayed.
• A viewport defines where it is to be displayed.
• Most of the time, windows and viewports are
usually rectangles in standard position(i.e
aligned with the x and y axes). In some
application, others such as general polygon shape
and circles are also available
• However, other than rectangle will take longer
time to process.

9
Viewing Transformation
• Viewing transformation is the mapping of a part
of a world-coordinate scene to device
coordinates.
• In 2D (two dimensional) viewing transformation is
simply referred as the window-to-viewport
transformation or the windowing transformation.
• Mapping a window onto a viewport involves
converting from one coordinate system to another.
• If the window and viewport are in standard
position, this just
• involves translation and scaling.
• if the window and/or viewport are not in
standard, then extra transformation which is
rotation is required.

10
Viewing Transformation
y-world
y-view
window
window
1
x-view
0
1
x-world
world
Normalised device
11
Window-To-Viewport Coordinate Transformation
Window-to-Viewport transformation
12
Window-To-Viewport Coordinate Transformation
YWmax
YVmax
xw,yw
xv,yv
YWmin
YVmin
XVmax
XVmin
XWmin
XWmax
13
Window-To-Viewport Coordinate Transformation
xv - xvmin xw - xwmin xvmax -
xvmin xwmax - xwmin   yv
yvmin yw - ywmin yvmax yvmin
ywmax - ywmin   From these two equations
we derived xv xvmin (xw xwmin)sx yv
yvmin (yw ywmin)sy where the scaling factors
are   sx xvmax xvmin sy yvmax -
yvmin xwmax xwmin
ywmax - ywmin
14
Window-To-Viewport Coordinate Transformation
The sequence of transformations are 1. Perform
a scaling transformation using a fixed-point
position of (xwmin,ywmin) that scales the window
area to the size of the viewport. 2. Translate
the scaled window area to the position of the
viewport.
15
Window-To-Viewport Coordinate Transformation
• Relative proportions of objects are maintained if
the scaling factors are the same (sx sy).
Otherwise, world objects will be stretched or
contracted in either x or y direction when
displayed on output device.
• How about character strings when map to viewport?
• maintains a constant character size (apply when
standard character fonts cannot be changed).
• If character size can be changed, then windowed
will be applied like other primitives.
• For characters formed with line segments, the
mapping to viewport is carried through sequence
of line transformations .

16
Viewport-to-Normalized Device Coordinate
Transformation
• From normalized coordinates, object descriptions
can be mapped to the various display devices
• When mapping window-to-viewport transformation is
• done to different devices from one normalized
space, it is
• called workstation transformation.

17
The Viewing Pipeline
18
OpenGL 2D Viewing Functions
• To transform from world coordinate to screen
coordinates, the appropriate matrix mode must be
chosen
• glMatrixMode (GL_PROJECTION)