0% found this document useful (0 votes)
8 views

graphics 1

The document provides an overview of computer graphics, including its definition, applications, and types of display devices such as CRT and flat panel displays. It discusses input and output devices, detailing various methods of user interaction, including keyboards, mice, touch screens, and audio input. Additionally, it covers virtual reality and augmented reality technologies, highlighting their components and applications in different fields.

Uploaded by

Virat D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

graphics 1

The document provides an overview of computer graphics, including its definition, applications, and types of display devices such as CRT and flat panel displays. It discusses input and output devices, detailing various methods of user interaction, including keyboards, mice, touch screens, and audio input. Additionally, it covers virtual reality and augmented reality technologies, highlighting their components and applications in different fields.

Uploaded by

Virat D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 170

Unit 1:

Introduction
1. Introduction to Computer
Graphics
 The computer graphics is one of the most effective and
commonly used way to communicate the processed
information to the user.
 It displays the information in the form of graphics
objects such as pictures, charts, graphs and diagrams
instead of simple text.
 The processing of geometric primitive with pixel level in
an image or graphical image.
 In computer graphics, pictures or graphics objects are
presented as a collection of discrete picture elements
called pixels.
Applications of Computer
Graphics
 User Interfaces
 Plotting of graphics and chart
 Office automation and Desktop publishing
 Computer-aided drafting and design
 Simulation and Animation
 Art and Commerce
 Process Control
 Cartography
Classification of CG
Applications
2. Video Display Devices

 Typically, the primary output device in a graphics


system is a video monitor.

 The operation of most video monitors is based on the


standard Cathode-Ray Tube (CRT) design.
Cathode-Ray Tube (CRT)

 A beam of electrons (cathode rays), emitted by an


electron gun, passes through focusing and deflection
systems that direct the beam toward specified positions
on the phosphor-coated screen.
 The phosphor then emits a small spot of light at each
position contacted by the electron beam.
 Because the light emitted by the phosphor fades very
rapidly, some method is needed for maintaining the
screen picture.
 One way to do this is to store the picture information as a charge
distribution within the CRT.
 This charge distribution can then be used to keep the phosphors
activated.
 However, the most common method now employed for maintaining
phosphor glow is to redraw the picture repeatedly by quickly directing the
electron beam back over the same screen points.
 This type of display is called a refresh CRT, and the frequency at which a
picture is redrawn on the screen is referred to as the refresh rate.
Cathode-Ray Tube (CRT)…
Cathode-Ray Tube (CRT)…
Cathode-Ray Tube (CRT)…
Raster-Scan Displays
 In raster-scan system, the electron beam is swept across the screen, one row
at a time, from top to bottom.

 Scan-line: Each row is referred to as a scan-line.

 Frame buffer or refresh buffer: Picture definition is stored in a memory area


called the refresh buffer or frame buffer.

 Frame: Where the term frame refers to the total screen area. This memory
area holds the set of color values for the screen points.

 Pixel or pel: Each screen spot that can be illuminated by the electron beam is
referred to as a pixel.

 Aspect ratio: the number of pixel columns divided by the number of scan lines
that can be displayed by the systems. 4/3
Raster-Scan Displays…
Raster Scan Display
Architecture
Random-Scan Displays

 When operated as a random-scan display unit, a CRT has


the electron beam directed only to those parts of the
screen where a picture is to be displayed.
 Pictures are generated as line drawings, with the
electron beam tracing out the component lines one
after the other.
 For this reason, random-scan monitors are also referred
to as vector displays or stroke-writing displays or
calligraphic displays.
 A pen plotter operates in a similar way and is an example of a random-
scan, hard-copy device.
 Refresh rate on a random-scan system depends on the number of lines to
be displayed on that system.
 Picture definition is now stored as a set of line-drawing commands in an
area of memory referred to as the display list, refresh display file, vector
file, or display program.
 Random-scan systems were designed for line-drawing applications, such as
architectural and engineering layouts, and they cannot display realistic
shaded scenes.
Vector display architecture
Random-Scan Displays…
Color CRT Monitors

 A CRT monitor displays color pictures by using a


combination of phosphors that emit different-colored
light.

 The emitted light from the different phosphors merges


to form a single perceived color, which depends on the
particular set of phosphors that have been excited.
Color CRT Monitors…
Direct-view Storage Tubes
(DVST)
 The direct-view storage tubes give the alternative
method of maintaining the screen image.
 A DVST uses the storage grid which stores the picture
information as a charge distribution just behind the
phosphor-coated screen.
 It consists of two electron guns: a primary gun (which
stores the picture pattern) and a flood gun (which
maintains the picture display).
Flat Panel: Plasma Panel
Display
 Also called gas-discharge displays.
 Plasma panel display writes images on the display
surface point by point, each point remains bright after
is has been intensified.
 It consists of two plates of glass with thin, closely
spaced gold electrodes.
 The gold electrodes are attached to the inner faces and
covered with a dielectric material.
Liquid Crystal Monitors

 The term liquid crystal refers to the fact that these


compounds have a crystalline arrangement of molecules,
yet they flow like a liquid.
 Flat panel displays commonly use nematic (thread like)
liquid-crystal compounds that tend to keep the long axes of
the rod-shaped molecules aligned.
 Two glass plates, each containing a light polarizer at right
angles to the other plate sandwich the liquid-crystal
material.
 Rows of horizontal transparent conductors are built into
one glass plate, and columns of vertical conductors are put
into the other plate.
 The intersection of two conductors defines a pixel position.
Graphics Input / Output
Devices
What’s available for input…

 touch - fingers, feet, breath


 sound - voice, other sounds
 gesture
 gaze
 brainwaves…
and output…
 textual information
 visual images - photos, diagrams, icons
 moving images
 sounds - music, voice
 Etc..
Input Devices

Used by a person to communicate to a computer.


Person to
computer
Output Devices

Displays information from the computer to a person.


Input Devices

 Keyboard.
 Mouse
 Microphone
 Digital
Camera
 Scanner
The Keyboard
The most commonly used input device is the
keyboard on which data is entered by manually
keying in or typing certain keys. A keyboard
typically has 101 or 105 keys.
Keyboard

 The keyboard allows the computer user to enter words, numbers,


punctuation, symbols, and special function commands into the computer’s
memory.
The Mouse
Is a pointing device which is used to control the
movement of a mouse pointer on the screen to
make selections from the screen. A mouse has one
to five buttons. The bottom of the mouse is flat
and contains a mechanism that detects movement
of the mouse.
Pointing devices - direct
 Touch screens
Touch screens
 Often used for applications with occasional
use, for example
 Bank ATMs, Information Kiosks, etc.
 No extra hardware - used for input and for
output
 Can be precise to 1 pixel
 Good for menu choice - not so good for
other functions
 Intuitive to use
Touch screens

 BUT

 Tiringif at wrong angle (needs to be


30-45% from horizontal)
 Get greasy, jammy
 Finger can obscure screen
 Alternative - use stylus to touch
screen, or lightpen
Indirect Pointing Devices

 Need more cognitive processing than


direct methods, but can be more
efficient

 mouse
 tracker ball
 track point
 touchpad…
Indirect pointing
devices - other
 Tracker ball, trackpad, trackpoint
 Less space on desktop
 Good in moving environments, e.g.
car, train
Indirect pointing devices -
other

 Joystick
 The main use of a joystick is to
play computer games by
controlling the way that
something moves on the
screen.
Microphones - Speech Recognition

•Use a microphone to talk to your


computer
•Add a sound card to your computer
•Sound card digitizes audio
input into 0/1s
•A speech recognition program can
process the input and convert it into
machine-recognized commands or
input
Audio Input: Speech Recognition
 Speech recognition is a
type of input in which the
computer recognizes
words spoken into a
microphone.
 Special software and a
microphone are required.
 Latest technology uses
continuous speech
recognition where the user
does not have to pause
between words.
Microphones - Speech Recognition
Digital camera
A digital camera can store many more
pictures than an ordinary camera. Pictures
taken using a digital camera are stored inside
its memory and can be transferred to a
computer by connecting the camera to it. A
digital camera takes pictures by converting
the light passing through the lens at the front
into a digital image.
Scanner
A scanner can be used to input pictures and
text into a computer. There are two main
types of scanner; Hand-held and Flat-bed.
Light pen
•A light pen is a small ‘pen-shaped’ wand,
which contains light sensors.
•It is used to choose objects or commands on
the screen either by pressing it against the
surface of the screen or by pressing a small
switch on its side.
•A signal is sent to the computer, which then
works out the light pen’s exact location on
the screen.
•The advantage of a light pen is that it
doesn’t need a special screen or screen
coating.
Bar codes

•A bar code is a set of lines of different thicknesses


that represent a number

•Bar Code Readers are used to input data from bar


codes. Most products in shops have bar codes on
them

•Bar code readers work by shining a beam of light


on the lines that make up the bar code and
detecting the amount of light that is reflected
back
Output Types

 Text output

 Graphics output

 Video output

 Audio output
Output Devices: Engaging our Senses

 Output devices are peripheral devices that enable us


to view or hear the computer’s processed data.
 Visual output – Text, graphics, and video
 Audio output – Sounds, music, and synthesized
speech
Output Devices

 Monitors

 Printers

 Speakers

 Data Projectors
Monitors

CRT LCD

 A monitor is a peripheral device which displays


computer output on a screen.
 Screen output is referred to as soft copy.
 Types of monitors:
 Cathode-ray tube (CRT)
 Liquid Crystal Display (LCD or flat-panel)
Monitors
CRT
 cathode ray tube
 electron gun shoots a stream of electrons at a specially
phosphor-coated screen
 on impact, the phosphor flares up for a fraction of a
second
 electron gun sweeps across the screen many times a
second
LCD
 liquid crystal display
 one of several types of “flat-panel” displays
 forms output by solidifying crystals and “backlighting” the
image with a light source
 TV sets are CRTs and many desktop monitors use this
technology
 LCD is primarily used for laptops and other portable
devices
Video Display Terminology
 Pixel
 picture element (smallest unit of an image, basically
a single dot on the screen)
 Resolution
 number of pixels in the image
 Common resolution size is 1024x768
 Refresh rate
 how often a CRT’s electron gun rescans The CRT electron gun
 LCD displays do not use an electron gun, so do not “shoots” 3 electrons at
perform refreshing the screen representing
the amount of red, green
and blue for the pixel
Printers

 Ink Jet Printer


 least expensive, color, slower with a
higher per page cost than laser
printers

 Laser Printer
 More expensive, faster, lower per page
cost than ink jet,
Printers
 A printer is a peripheral device that
produces a physical copy or hard
copy of the computer’s output.
Types of Printers

Inkjet Laser

 Inkjet printer, also called a  Laser printer works like a


bubble-jet, makes copier
characters by inserting dots  Quality determined by dots
of ink onto paper per inch (dpi) produced
 Letter-quality printouts  Color printers available
 Cost of printer is inexpensive  Expensive initial costs but
but ink is costly cheaper to operate per
page
Plotter

 A plotter is a printer that uses a pen that moves over a large revolving
sheet of paper.
 It is used in engineering, drafting, map making, and seismology.
Audio Output: Sound Cards and
Speakers

 Audio output is the ability of the computer to output sound.


 Two components are needed:
 Sound card – Plays contents of digitized recordings
 Speakers – Attach to sound card
Virtual Reality I/O Devices

Immersion
 VR Triangle or I3

Imaginatio Interactio
n n
What is Virtual Reality?

Definition:
Virtual Reality is a high-end user-computer interface that involves real-
time simulation and interactions through multiple sensorial channels.
These sensorial modalities are visual, auditory, tactile, smell and taste.

“It is a computer-simulated reality which replicates an environment, real or


imagined and simulates a user’s physical presence and environment to
allow for user interaction”
VR System Architecture…
Virtual Reality Triangle
Mixed Reality Timeline
Augmented Reality

 It is a virtuality environment, means virtual content in


real environment.

 AR is a live direct or indirect view of a physical, real-


world environment whose elements are augmented or
supplemented by computer-generated sensory input
such as sound, video, graphics or GPS data.
Techniques of Virtual/Mixed Reality

 Modeling
 Geometric modeling

 Kinematics modeling

 Physical modeling

 Behavior modeling

 Model management
Continue…

 Selection and Manipulation

 Travel

 Wayfinding
 Hand Dataglove…

 Head Mounted Display

 Eye Tracker
Virtual Reality Equipments
Hand Dataglove
Continue…

 Hand Dataglove
Continue…

 Head Mounted Display (HMD)


Head Mounted Display
Continue…

 Full body motion tracker


Eye Tracker
3D Space controller
Continue…

 CAVE (Cave Automatic Virtual Environment)


Continue…

 Face tracker
Virtual Reality tools and

packages
Cortona 3D

 VRML

 OpenSceneGraph

 WorldToolKit

 Java 3D

 APIs

 AR toolkits
Demo Videos

 Traditional application

 Medical applications 1 2

 Education, Arts, and Entertainment 1

 Military VR applications 1
Continue…

 Emerging applications of VIR

 VR applications in manufacturing

 Applications of VR in Robotics 1 2

 Information Visualization 1 2
3. Raster-Scan Systems

 Interactive raster-graphics systems typically employ


several processing units.
 In addition to the CPU, a special-purpose processor,
called the video controller or display controller, is used
to control the operation of the display device.
 Here, the frame buffer can be anywhere in the system
memory, and video controller accesses the frame buffer
to refresh the screen.
Video Controller

 A fixed area of the system memory is reserved for the


frame buffer, and the video controller is given direct
access to the frame-buffer memory.
 Frame-buffer locations, and the corresponding screen
positions, are referenced in Cartesian coordinates.
Raster-Scan Display Processor

 A major task of the display processor is digitizing a


picture definition given in an application program into a
set of pixel values for storage in the frame buffer.
 This digitization process is called scan conversion.
Vector Scan vs Raster Scan
Display
4. Coordinate System

 Most of the graphics packages use cartesian coordinate


systems.

 However, in some applications non-cartesian coordinate


systems such as spherical, cylindrical, or other
symmetries are useful.
Viewing Pipeline
2D and 3D Coordinate
Representations
Polar Coordinate Reference
Frame
Coordinate Representations
Interactive and Passive
Graphics
 Non-Interactive or Passive Computer Graphics:
 In non-interactive computer graphics, the picture is
produced on the monitor, and the user does not have any
controlled over the image, i.e., the user cannot make any
change in the rendered image. One example of its Titles
shown on T.V.
 Non-interactive Graphics involves only one-way
communication between the computer and the user, User
can see the produced image, and he cannot make any
change in the image.
Interactive and Passive
Graphics…
 Interactive Computer Graphics:
 In interactive Computer Graphics user have some controls
over the picture, i.e., the user can make any change in
the produced image. One example of it is the ping-pong
game.
 Interactive Computer Graphics require two-way
communication between the computer and the user. A
User can see the image and make any change by sending
his command with an input device.
Graphics Software and
Libraries
 Software Standards:
 The primary goal of standardized graphics software is
portability.
 When packages are designed with standard graphics
functions, software can be moved easily from one
hardware system to another and used in different
implementations and applications.
 Without standards, programs designed for one hardware
system often cannot be transferred to another system
without extensive rewriting of the programs.
 International and national standards-planning organizations in many
countries have cooperated in an effort to develop a generally accepted
standard for computer graphics.
 GKS in 1984
 PHIGS and PHIGS+
 SGI
 OpenGL architecture review board
 Language binding
Other Graphics Packages

 Open Inventor
 Virtual Reality Modeling Language (VRML)
 Java2D
 Java3D
 RenderMan Interface
 Mathematica
 Matlab
 Maple
Problems

1. A video monitor has a display area measuring 12 inch


by 9.6 inch. If the resolution is 1280x1024 and the
aspect ratio is 1. What is the diameter of each screen
point.
2. What is the fraction of the total refresh time per
frame spent in retrace of the electron beam for a non-
interlaced raster system with a resolution of
1280x1024, a refresh rate of 60Hz, a horizontal
retrace time of 5microsecond and a vertical retrace
time of 500 microseconds?
Primitives: Basic Graphics
Primitives
I. Scan conversion a Line.

II. Scan conversion Circle.

III. Scan conversion Ellipse.

 Filled area Primitives.


I. Scan conversion a Line
 It is a process of representing graphics objects a collection of pixels.
 The graphics objects are continuous. The pixels used are discrete. Each
pixel can have either on or off state.
 The circuitry of the video display device of the computer is capable of
converting binary values (0, 1) into a pixel on and pixel off information. 0
is represented by pixel off. 1 is represented using pixel on. Using this
ability graphics computer represent picture having discrete dots.
 Any model of graphics can be reproduced with a dense matrix of dots or
points. Most human beings think graphics objects as points, lines, circles,
ellipses. For generating graphical object, many algorithms have been
developed.
Advantages for scan
conversion a line
 Algorithms can generate graphics objects at a faster
rate.

 Using algorithms memory can be used efficiently.

 Algorithms can develop a higher level of graphical


objects.
Pixel or Pel

 The term pixel is a short form of the picture element. It is


also called a point or dot. It is the smallest picture unit
accepted by display devices.
 A picture is constructed from hundreds of such pixels.
Pixels are generated using commands. Lines, circle, arcs,
characters; curves are drawn with closely spaced pixels. To
display the digit or letter matrix of pixels is used.
 The closer the dots or pixels are, the better will be the
quality of picture. Closer the dots are, crisper will be the
picture.
 Picture will not appear jagged and unclear if pixels are
closely spaced. So the quality of the picture is directly
proportional to the density of pixels on the screen.
Pixel or Pel…
Pixel or Pel…
 Different graphics objects can be generated by setting the different
intensity of pixels and different colors of pixels. Each pixel has some co-
ordinate value. The coordinate is represented using row and column.
 P (5, 5) used to represent a pixel in the 5th row and the 5th column. Each
pixel has some intensity value which is represented in memory of
computer called a frame buffer.
 Frame Buffer is also called a refresh buffer. This memory is a storage area
for storing pixels values using which pictures are displayed. It is also
called as digital memory.
 Inside the buffer, image is stored as a pattern of binary digits either 0 or
1. So there is an array of 0 or 1 used to represent the picture. In black and
white monitors, black pixels are represented using 1's and white pixels are
represented using 0's. In case of systems having one bit per pixel frame
buffer is called a bitmap. In systems with multiple bits per pixel it is
called a pixmap.
Scan converting a Point

 Each pixel on the graphics display does not represent a


mathematical point.
 Instead, it means a region which theoretically can
contain an infinite number of points.
 Scan-Converting a point involves illuminating the pixel
that contains the point.
Scan converting a Point…
Scan converting a Straight
Line
 A straight-line segment in a scene is defined by the
coordinate positions for the endpoints of the segment.
 To display the line on a raster monitor, the graphics
system must first project the endpoints to integer
screen coordinates and determine the nearest pixel
positions along the line path between the two
endpoints.
 Then the line color is loaded into the frame buffer at
the corresponding pixel coordinates.
Scan converting a Straight
Line…
 Reading from the frame buffer, the video controller
plots the screen pixels.
 This process digitizes the line into a set of discrete
integer positions that, in general, only approximates the
actual line path.
Line Equations

 We determine pixel positions along a straight-line path


from the geometric properties of the line.
 The Cartesian slope-intercept equation for a straight-
line is: y=m.x + b
Properties of Good Line
Drawing Algo.:
 Line should appear Straight.

 Lines should terminate accurately.

 Lines should have constant density.

 Line density should be independent of line length and


angle.

 Line should be drawn rapidly.


Algorithms for Line drawing

 Direct use of line equation.

 Digital Differential Analyzer (DDA).

 Bresenham’s Algorithm.
Basic concept of Line drawing
Direct use of Line Equation

 It is the simplest form of conversion. First of all scan


P1 and P2 points. P1 has co-ordinates (x1',y1') and (x2' y2'
).
 Then m = (y2',y1')/( x2',x1') and
 If value of |m|≤1 for each integer value of x. But do not
consider
 If value of |m|>1 for each integer value of y. But do not
consider
Algorithm for drawing line
using

equation
Step1: Start Algorithm
 Step2: Declare variables x1,x2,y1,y2,dx,dy,m,b,
 Step3: Enter values of x1,x2,y1,y2.
The (x1,y1) are co-ordinates of a starting point of the line.
The (x2,y2) are co-ordinates of a ending point of the line.
 Step4: Calculate dx = x2- x1
 Step5: Calculate dy = y2-y1

 Step6: Calculate m =

 Step7: Calculate b = y1-m* x1


 Step8: Set (x, y) equal to starting point, i.e., lowest point and xendequal
to largest value of x.
 If dx < 0
then x = x2
y = y2
xend= x1
If dx > 0
then x = x1
y = y1
xend= x2
 Step9: Check whether the complete line has been drawn if x=xend, stop
 Step10: Plot a point at current (x, y) coordinates
 Step11: Increment value of x, i.e., x = x+1
 Step12: Compute next value of y from equation y = mx + b
 Step13: Go to Step9.
 Example: A line with starting point as (0, 0) and ending point (6, 18) is
given. Calculate value of intermediate points and slope of line.
 Solution: P1 (0,0) P7 (6,18)
 x1=0
y1=0
x2=6
y2=18

 We know equation of line is


y =m x + b
y = 3x + b..............equation (1)
 put value of x from initial point in equation (1), i.e., (0, 0) x =0, y=0
0=3x0+b
0 = b ⟹ b=0
 put b = 0 in equation (1)
 y = 3x + 0
y = 3x
 Now calculate intermediate points
Let x = 1 ⟹ y = 3 x 1 ⟹ y = 3
Let x = 2 ⟹ y = 3 x 2 ⟹ y = 6
Let x = 3 ⟹ y = 3 x 3 ⟹ y = 9
Let x = 4 ⟹ y = 3 x 4 ⟹ y = 12
Let x = 5 ⟹ y = 3 x 5 ⟹ y = 15
Let x = 6 ⟹ y = 3 x 6 ⟹ y = 18
 So points are P1 (0,0)
P2 (1,3)
P3 (2,6)
P4 (3,9)
P5 (4,12)
P6 (5,15)
P7 (6,18)
Direct Differential Analyzer
(DDA)
 DDA stands for Digital Differential Analyzer.
 It is an incremental method of scan conversion of line.
In this method calculation is performed at each step but
by using results of previous steps.
 The DDA is a scan-conversion line algorithm based on
calculating either ᵟy and ᵟx, using line equations.
DDA Algorithm
Advantages of DDA

 Advantages:
 It is a faster method than method of using direct use of
line equation.
 This method does not use multiplication theorem.
 It allows us to detect the change in the value of x and y, so
plotting of same point twice is not possible.
 This method gives overflow indication when a point is
repositioned.
 It is an easy method because each step involves just two
additions.
Disadvantages of DDA

 Disadvantages:
 It involves floating point additions rounding off is done.
Accumulations of round off error cause accumulation of
error.
 Rounding off operations and floating point operations
consumes a lot of time.
 It is more suitable for generating line using the software.
But it is less suited for hardware implementation.
 Example: If a line is drawn from (2, 3) to (6, 15) with use of DDA. How
many points will needed to generate such line?
 Solution: P1 (2,3) P11 (6,15)
 x1=2
y1=3
x2= 6
y2=15
dx = 6 - 2 = 4
dy = 15 - 3 = 12
m=
 For calculating next value of x takes x = x + 1/m

Problems of DDA

 Consider the line from (0,0) to (4,6). Use the simple


DDA algorithm to rasterize this line segment.

 Consider the line from (0,0) to (-6,-6). Use the simple


DDA algorithm to rasterize this line segment.
Bresenham’s Line Drawing
Algorithm
 This algorithm is used for scan converting a line.
 It was developed by Bresenham.
 It is an efficient method because it involves only integer
addition, subtractions, and multiplication operations.
These operations can be performed very rapidly so lines
can be generated quickly.
 In this method, next pixel selected is that one who has
the least distance from true line.
Bresenham’s Algorithm
Advantages of Bresenham’s
Algorithm
 Advantages:
 It involves only integer arithmetic, so it is simple.
 It avoids the generation of duplicate points.
 It can be implemented using hardware because it does not
use multiplication and division.
 It is faster as compared to DDA (Digital Differential
Analyzer) because it does not involve floating point
calculations like DDA Algorithm.
Disadvantages of
Bresenham’s Algorithm
 Disadvantages:
 This algorithm is meant for basic line drawing only
Initializing is not a part of Bresenham's line algorithm. So
to draw smooth lines, you should want to look into a
different algorithm.
 Example: Starting and Ending position of the line are
(1, 1) and (8, 5). Find intermediate points.
 Solution: x1=1
y1=1
x2=8
y2=5
dx= x2-x1=8-1=7
dy=y2-y1=5-1=4
I1=2* ∆y=2*4=8
I2=2*(∆y-∆x)=2*(4-7)=-6
d = I1-∆x=8-7=1
x y d=d+I1 or I2

1 1 d+I2=1+(-6)=-5
2 2 d+I1=-5+8=3
3 2 d+I2=3+(-6)=-3
4 3 d+I1=-3+8=5
5 3 d+I2=5+(-6)=-1
6 4 d+I1=-1+8=7
7 4 d+I2=7+(-6)=1
8 5
Difference Between DDA and
Bresenham’s Line Algorithms
DDA Algorithm Bresenham's Line Algorithm

1. DDA Algorithm use floating point, 1. Bresenham's Line Algorithm use


i.e., Real Arithmetic. fixed point, i.e., Integer Arithmetic

2. DDA Algorithms uses multiplication & 2.Bresenham's Line Algorithm uses only
division its operation subtraction and addition its operation

3. DDA Algorithm is slowly than 3. Bresenham's Algorithm is faster than


Bresenham's Line Algorithm in line DDA Algorithm in line because it
drawing because it uses real arithmetic involves only addition & subtraction in
(Floating Point operation) its calculation and uses only integer
arithmetic.

4. DDA Algorithm is not accurate and 4. Bresenham's Line Algorithm is more


efficient as Bresenham's Line Algorithm. accurate and efficient at DDA
Algorithm.

5.DDA Algorithm can draw circle and 5. Bresenham's Line Algorithm can
curves but are not accurate as draw circle and curves with more
Bresenham's Line Algorithm accurate than DDA Algorithm.
Antialiasing of Lines
 In the line drawing algorithm, we have seen that all rasterized locations
do not match with the true line and we have to select the optimum
raster locations to represent a straight line.

 This problem is severe in low resolution screens. In such screens line


appears like a stair-step.

 The aliasing effect is the appearance of jagged edges or “jaggies” in a


rasterized image (an image rendered using pixels).
 The problem of jagged edges technically occurs due to distortion of the
image when scan conversion is done with sampling at a low frequency,
which is also known as Undersampling.
 Aliasing occurs when real-world objects which comprise of smooth,
continuous curves are rasterized using pixels.
 Antialiasing is a technique used in computer graphics to remove the
aliasing effect.
 The aliasing effect can be reduced by adjusting intensities of the pixels
along the line.
 The process of adjusting intensities of the pixels along the line to
minimize the effect of aliasing is called antialiasing.
Methods of Antialiasing:

 Increasing resolution:
 Unweighted area sampling: The intensity of pixel is proportional to the
amount of line area occupied by the pixel. This technique produces
noticeably better results than does setting pixels either to full intensity or
to zero intensity.
 Weighted area sampling: in weighted area sampling equal areas
contribute unequally i.e. a small area closer to the pixel center has
greater intensity than does one at a greater distance. Thus, the intensity
of the pixel is dependent on the line area occupied and the distance of
area from the pixel’s center.
Displaying Polylines
 Implementation of a polyline procedure is accomplished by invoking a
line-drawing routine n-1 times to display the line connecting the n
endpoints.
 Each successive call passes the coordinate pair needed to plot the next
line section, where the first endpoint of each coordinate pair is the last
endpoint of the previous section.
 Once the color values for pixel positions along the first line segment have
been set in the frame buffer, we process subsequent line segments
starting with the next pixel position following the first endpoint for that
segment.
 In this way, we can avoid setting the color of some endpoints twice.
Parallel Line Algorithms

 Using parallel processing, we can calculate multiple


pixel positions along a line path simultaneously by
partitioning the computations among the various
processors available.
 One approach to the partitioning problem is to adapt an
existing sequential algorithm to take advantage of
multiple processors.
 Alternatively, to set up the processing so that pixel
positions can be calculated efficiently in parallel.
 An important consideration in devising a parallel
algorithm is to balance the processing load among the
available processors.
 Given np processors, we can set up a parallel Bresenham line algorithm by
subdividing the line path into np partitions and simultaneously generating
line segments in each of the subintervals.
 For a line with slope 0 < m < 1 and left endpoint coordinate position (x0,
y0), we partition the line along the positive x direction.
 The distance between beginning x positions of adjacent partitions can be
calculated as:
 Numbering the partitions, and the processors, as 0,1,2, up to np-1, we
calculate the starting x coordinate for the kth partition as:
Scan Conversion Circle

 A circle is defined as the set of points that are all at a


given distance r from a center position.
 Circle is an eight-way symmetric figure.
 The shape of circle is the same in all quadrants. In each
quadrant, there are two octants.
 If the calculation of the point of one octant is done,
then the other seven points can be calculated easily by
using the concept of eight-way symmetry.
Defining circle using
Polynomial method
 The first method defines a circle with the second-order
polynomial equation as shown in fig:
 y2=r2-x2
Where x = the x coordinate
y = the y coordinate
r = the circle radius
 With the method, each x coordinate in the sector, from
90° to 45°, is found by stepping x from 0 to r/√2 &
each y coordinate is found by evaluating √ r2-x2 for each
step of x.
Defining circle using Polar
Coordinates
 The second method of defining a circle makes use of
polar coordinates as shown in fig:
 x=r cos θ y = r sin θ
Where θ=current angle
r = circle radius
x = x coordinate
y = y coordinate
 By this method, θ is stepped from 0 to π/4 & each
value of x & y is calculated.
DDA Circle Drawing Algorithm

 The equation of circle, with origin as the center of the


circle is given as:
 The DDA algorithm can be used to draw the circle by
defining circle as a differential equation.
DDA Circle Drawing
Algorithm…
Bresenham’s Circle Algorithm

 The Bresenham’s circle drawing algorithm considers the


eight-way symmetry of the circle to generate it.
 It plots 1/8th part of the circle, i.e. from 90 degree to
45 degree.
 As circle is drawn from 90 degree to 45 degree, the x
moves in positive direction and y moves in the negative
direction.
 To achieve best approximation to the true circle we have to select those
pixels in the raster that fall the least distance from the true circle.
 Let us observe the 90 degree to 45 degree portion of the circle.
 It can be noticed that if points are generated from 90 degree to 45
degree, each point closest to the true circle can be found by applying
either of the two options:
 Increment in positive x direction by one unit or
 Increment in positive x direction and negative y direction both by one unit.
Bresenham’s algo. to plot
1/8th of the circle
Midpoint circle drawing
algorithm
 The midpoint circle drawing algorithm also uses the
eight-way symmetry of the circle to generate it.
Midpoint circle drawing
algorithm…
Scan conversion of Ellipse

You might also like