Sunteți pe pagina 1din 20

3.

1 Computer Graphics Principles


Design models are principally geometric or
graphical in nature and therefore the way the
models are achieved is through graphics.

Computer graphics may be categorized as:


→Based on the user control over the image as
passive or interactive graphics.
→Based on the way the image is generated as
vector graphics or raster graphics.

In vector graphics, the image consists of a


number of line segments. In raster graphics, the
image is made by a matrix of dots called pixels,
and involves manipulation of the colour and
intensity of the pixels. 1
Computer Graphics Principles (continuation)

Line drawing makes use of vector


graphics. Similarly vector graphics is used
in the creation of wireframe models.
Raster graphics is used in the display of
surfaces and photorealistic displays. In
either case, raster display hardware is
almost universally employed.

2
3.2 Hardware for Computer Graphics
• Display devices
• Hardcopy devices
• Interface devices
 Display devices
Cathode Ray Tube (CRT) of the raster-scan type.
(Vector display devices [random scan] were popular only
up to 1980’s).
→ Raster scan principle is based on controlling intensity of
each pixel on the screen of the display device, like in TV.
→ The display receive information on the status of pixels
from a display memory or frame buffer
→ In the case of monochrome, each pixel can be
represented by a single bit with 0 black and 1 white or
vice versa.
3
Hardware for Computer Graphics (continuation)

→In case of colour or shades of grey,


additional bits are allocated to each pixel.
eg. 4 bits per pixel represents 24 = 16.
while 8 bits represents 28 = 256 colours.
→High performance graphics devices
generally assign 24 bits per pixel to
represent intensity level of the separate
red, green and blue guns of CRT.
→Modern raster displays have resolutions of
640x480 to 1800x1600 pixels or higher.
. 4
Hardware for Computer Graphics (continuation)

Other display devices – flat panel display


devices: A class of video display devices that
are small in volume, weight and power
consumption. A significant feature of such
devices is that they are much thinner than CRTs.
Examples of their uses:

• modern TV monitors
• calculators
• pocket video games
• laptop computers
• wrist watches etc.

5
Hardware for Computer Graphics (continuation)

Flat panel displays fall into two categories:


 Emissive displays (emitters): they convert
electrical energy to light eg.
→Light emitting diodes (LED)
→Plasma panels
 Non emissive displays (non emitters): use
optical effects to convert sunlight or light from
other sources into graphics pattern, eg.
→Liquid crystal displays (LCD)
6
Hardware for Computer Graphics (continuation)

 Hard copy devices


Vector plotters: Image is produced by drawing a series
of line segments by moving a pen relative to the paper or
vice versa (pen plotters). Pen plotters may allow multiple
pen types for different line types/lineweights.
Raster plotters: Image is created as a matrix of points.
Several types exist, eg.
→ Dot matrix devices: use impacting needles on an inked
ribbon. Resolution is generally low.
→ Electrostatic devices (electrostatic plotters)
→ Lazer based devices: (lazer plotter/printer)
→ Inkjet devices that spray ink of different colours from tiny
jets in a print head that travel across the paper.
→ Thermal devices that transfer wax, ink or dye by
selective heating of fine print pins. 7
 Intput devices:
→ Keyboard
• alphanumeric keyboard for inputing non graphic data.
• Function keys allow user to enter frequently used
operations in a single keystroke.
• Numeric keypad often included in keyboard for fast entry
of numeric data.
→ Mouse
• A small hand held box used to position the screen cursor
• A wheel or roller at the bottom of the mouse is used to
record the amount and direction of movement.
• Other mouse systems have optical sensor to detect
movement
• Additional devices eg. a thumbwheel on the sides, a
trackball on top, etc can be included on the basic mouse
to allow picking of an object, rotate it, move it to in any
direction etc.
8
→ Trackball and Spaceball
• A trackball is a ball that can be rotated with fingers or
palm to produce screen cursor movement.
Potentiometers attached to the ball measure the amount
and direction of movement
• While a trackball is a 2D positioning device, a spaceball
provides 6 degrees-of-freedom. Unlike a trackball, a
spaceball does not move. Strain gages measure the
amount of pressure applied to the spaceball to provide
input for spatial positioning and orientation as the ball is
pushed or moved in various directions.
• Spaceballs are used for 3D positioning and selection
operations in virtual-reality systems, modelling,
animation, CAD and other applications.

9
→ Joystick
• A Joystick is a vertical level mounted on a base that is
used to steer the screen cursor around.
• Most joysticks select screen positions with actual
movement of the stick, but others respond to the
pressure on the stick
→ Digitizer
• A device for drawing, painting or interactively select
coordinate positions on an object.
• Can be used to input coordinate values in 2D or 3D
space.
• Typically a digitizer is used to scan over a drawing or
object and input a set of discrete coordinate positions.
• One type of digitizer is the graphics tablet which is used
to input 2D coordinates by activating a hand cursor or
stylus at selected positions on a flat surface.
• A hand cursor contains a cross hair for sighting
positions, while a stylus is a pencil shaped device that is
10
pointed at positions on the tablet.
3.3 Image generation in 2D computer graphics

 Image in 2D graphics is displayed by the following steps:

• Conversion of geometric representation of the model to a


form that may be manipulated easily by the graphics
routine i.e curves and texts converted into a series of
lines: (vector generation)
• Map or transform the lines from the coordinate system
in which they are defined (model coordinate system) to
the coordinate system of the screen
• Select those lines that will not be visible within the
display area on the screen and discard the remainder
(clipping)
• Instruct the display device to draw the visible lines.

11
Vector generation
→Many graphic systems display graphics
images as a collection of lines on the
screen
→Vector representation allows the display of
any geometric entity and simplifies image
manipulation
→The aim is to use a sufficient number of
lines so that the curve appears smooth.
The number of lines is controlled by
display tolerance

12
13
Mapping/Transformation
→Next step is to map or transform the vectors
from the model coordinates to the screen
coordinates of the display device. This is
accomplished using the concepts of windows
and viewports.
→Display control commands such as Zoom, Pan
etc may be selected to display only part of the
model
→A window may be defined as an imaginary
rectangular frame/boundary through which the
user looks into the model. Viewport is the area
on the screen which the contents of the window
are to be displayed as an image
14
Mapping/Transformation (Continuation)
→The task of generating a model is that of viewing
transformation or mapping from model
coordinate system to the screen coordinate
system
→A general case of transformation may also
involve some kind of rotation.

Example of a viewing transformation


Consider transformation of point (xw,yw) of the
model (in model coordinates), to point (xs,ys) in
screen coordinates:

15
window

16
Viewport

17
• We can write expressions for the transformation of
point (Xw,Yw) in model coordinates to (Xs,Ys) in
screen coordinates as follows:

18
Values of a, b, c and d may be computed when the
window and viewport are defined, i.e.

19
Clipping:
When a window shows only part of the model,
vectors outside the window have to be
discarded. This is done by an operation called
clipping. Many algorithms for clipping have been
developed.
Drawing lines:
At this stage, the program has a collection of
streams of clipped transformed vectors to form
the image. All that remain is to draw them on the
display device.
• Line drawing on raster scan devices is done by
setting appropriate bits in the display memory
20

S-ar putea să vă placă și