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

CGIP MOD 1

The document provides an overview of computer graphics and image processing, detailing the basics, algorithms, display devices, and applications in various fields such as CAD, education, and entertainment. It discusses different types of display technologies, including raster and random scan displays, and explains key concepts like pixels, resolution, and aspect ratios. Additionally, it highlights the significance of image processing techniques for enhancing picture quality and machine perception.

Uploaded by

leemong335
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)
5 views

CGIP MOD 1

The document provides an overview of computer graphics and image processing, detailing the basics, algorithms, display devices, and applications in various fields such as CAD, education, and entertainment. It discusses different types of display technologies, including raster and random scan displays, and explains key concepts like pixels, resolution, and aspect ratios. Additionally, it highlights the significance of image processing techniques for enhancing picture quality and machine perception.

Uploaded by

leemong335
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/ 111

COMPUTER GRAPHICS

&
IMAGE PROCESSING

1
COURSE OUTCOMES
Syllabus
MODULE I

Module – 1(Basics of Computer graphics and Algorithms)

• Basics of Computer Graphics and its applications.

• Video Display devices- Refresh Cathode Ray Tubes, Random Scan


Displays and systems, Raster scan displays and systems.

• Line drawing algorithms- DDA, Bresenham’s algorithm.

• Circle drawing algorithms- Midpoint Circle generation, algorithm,


Bresenham’s algorithm.
“A picture is worth a thousand words”
Basic concepts in Computer Graphics

• Computer graphics is an art of drawing pictures on computer screens with


the help of programming.

• Computer graphics generally refers to the specific creation, storage, and


manipulation of image data using a digital computer with the help of a
specialized graphical system.

• Which studies methods for digitally synthesizing and manipulating visual


content.
Applications of Computer Graphics

Computer-Aided Design (CAD)


CAD methods are now routinely used in the design of buildings, automobiles, aircraft,
watercraft, spacecraft computers, textiles, and many other products.
Computer-Aided Design (CAD)

• Objects are displayed in wire frame outline form


◼ Software packages provide multi-window environment
◼ Graphics design package provides standard shapes (useful for
repeated placements)
◼ Animations are also used in CAD applications
◼ Realistic displays of architectural design permits simulated
“walk” through the rooms (virtual-reality systems)
Presentation Graphics
• Presentation Graphics programs are used to produce illustrations for reports
or to generate PowerPoint presentations.

• It is commonly used to summarize financial, statistical, mathematical,


scientific, and economic data for research reports, managerial reports
consumer information bulletins, and other types of reports.

• Examples: Bar charts, line graphs, pie charts, surface graphs, time charts,...
Presentation Graphics
Computer Art
• Computer graphics methods are widely used in both fine art and commercial
art applications.
• Includes artist’s paintbrush programs, paint packages, CAD packages and
animation packages
• These packages provides facilities for designing object shapes & specifying
object motions.
• Examples: Cartoon drawings, paintings, product advertisements, logo design,
etc.
Entertainment

Computer graphics methods are now commonly used in


making motion pictures, music videos, and television shows.
Entertainment

Movie industry
Computer graphics methods are now commonly used in
making motion pictures, music videos, and television shows.
Game Industry
Focus on interactivity
Cost effective solutions
Avoiding computations and other tricks
A common graphics method employed in many commercials is
morphing, where one object is transformed into another.
Education and Training
◼ Computer generated models of physical, financial and economic
systems are used as educational aids
◼ Models of physical systems, physiological systems, population
trends, or equipment such as color-coded diagrams help trainees
understand the system’s operation
◼ Specialized systems used for training applications
◼ Simulators for practice sessions and training of :
◼ ship captains
◼ aircraft pilots
◼ heavy equipment operators
◼ air traffic-control personnel
Education and Training
Visualization
Scientific engineers, medical personnel, business analysts, and others often need to
analyse large amounts of information or study the behaviour of certain processes.
Image Processing
In computer graphics, a computer is used to create a picture.
Image processing, on the other hand, applies techniques to modify or interpret existing pictures,
such as photographs and TV scans. Two principal applications of image processing are
improving picture quality and machine perception of visual information as used in robotics.
Pixel
• The picture element is called as Pixel or pel

• Pixel is the smallest element of an image.

• Each pixel correspond to any one value.

• In an 8-bit gray scale image, the value of the pixel between 0 and 255.

• The value of a pixel at any point correspond to the intensity of the light
and that is also known as gray level.
In the first picture, there may be thousands of pixels, that together make
up this image.

We will zoom that image to the extent that we are able to see some pixels
division.
Calculation of total number of pixels

• We have define an image as a two dimensional signal or matrix.

• Then in that case the number of PEL would be equal to the


number of rows multiply with number of columns.

• This can be mathematically represented as below:


Total number of pixels = number of rows ( X ) number of columns
Pixel value
• Each pixel can have only one value and each value denotes the intensity
of light at that point of the image.
• The value 0 means absence of light. It means that 0 denotes dark, and it
further means that when ever a pixel has a value of 0, it means at that
point, black color would be formed.
0 0 0
• Have a look at this image matrix 0 0 0
0 0 0

• Total no of pixels = total no. of rows X total no. of columns


= 3×3 = 9 pixels.
An image would be formed with 9 pixels, and that image would have a
dimension of 3 rows and 3 column and most importantly that image
would be black.
• Aspect ratio is the ratio of the width of an image to the height of the
image.

• This ratio is expressed as x:y, and differs in case of different


images used in photography, television, computer applications and so
on.
• The resolution of an image is the total number of pixels displayed
on your computer or television screen.
• Generally, the higher the resolution, the higher is the quality of the
image.
Aspect ratio Resolution

Ratio of the width of an image to Total number of pixels displayed


the height of the image (x:y). on your computer or television
screen without overlap.

The common aspect ratios used The common monitor


are 4:3,16:9 resolutions are 640x480,
800x600 and 1024x768.
Display devices
• The display device is an output device used to represent the
information in the form of images (visual form).

• Display systems are mostly called a video monitor or Video display


unit (VDU).

• The purpose of display technology is to simplify information sharing.


Display devices

• Cathode-Ray Tube(CRT)
• Color CRT Monitor
• Liquid crystal display(LCD)
• Light Emitting Diode(LED)
• Direct View Storage Tubes(DVST)
• Plasma Display
• 3D Display
Cathode-Ray Tube(CRT)

• The primary output device in a graphics system is a video monitor.


• The operations of the video monitors is based on the standard
cathode ray tubes design.
• A CRT is an electronic tube designed to display electricaldata.
The basic CRT consists of 4 major components
• Electron gun
• Focusing and accelerating anode
• Horizontal and vertical deflection plates
• Evacuated glass envelop
Video Display Devices Electron gun,
Focusing and deflection systems,
Phosphor-coated screen
Refresh Cathode Ray Tubes (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 keep the phosphor glowing is to redraw the picture


repeatedly by quickly directing the electron beam back over the
same points.

• This type of display is called a refresh CRT


• The primary components of an electron gun in a CRT are the
heated metal cathode and a control grid.

• Heat is supplied to the cathode by directing a current through


a coil of wire, called the filament, inside the cylindrical cathode
structure.
• This causes electrons to be ‘boiled off" the hot cathode surface.

• In the vacuum inside the CRT envelope, the free, negatively charged
electrons are then accelerated toward the phosphor coating by a
high positive voltage.
• The accelerating voltage can be generated with a positively
charged metal coating on the inside of the CRT envelope near
the phosphor screen, or an accelerating anode can be used.

• Intensity of the electron beam is controlled by setting voltage


levels on the control grid, which is a metal cylinder that fits over
the cathode.
• Since the amount of light emitted by the phosphor coating depends
on the number of electrons striking the screen, we control the
brightness of a display by varying the voltage on the control grid.

• The focusing system in a CRT is needed to force the electron beam


to converge into a small spot as it strikes the phosphor.

• Otherwise, the electrons would repel each other, and the beam would
spread out as it approaches the screen.

• Focusing is accomplished with either electric or magnetic fields.


Electrostatic focusing is commonly used in television and computer
graphics monitors.
• As with focusing, deflection of the electron beam can be
controlled either with electric fields or with magnetic fields.

• Different kinds of phosphors are available for use in a CRT. Besides


color, a major difference between phosphors is their persistence,
how long they continue to emit light after the CRT beam is
removed.

• Persistence is defined as the time it takes the emitted light from


the screen to decay to one-tenth of its original intensity.
• Lower persistence phosphors require higher refresh rates to
maintain a picture on the screen without flicker.

• A phosphor with low persistence is useful for animation, a high-


persistence phosphor is useful for displaying highly complex, static
pictures.

• Although some phosphors have a persistence greater than 1


second, graphics monitors are usually constructed with a
persistence in the range from 10 to 60 microseconds.
There are two ways Random scan and Raster scan by which we can display
an object on the screen.
Raster scan display
• The most common type of graphics monitor employing a CRT is the
raster-scan display, based on television technology.

• In a raster-scan system, the electron beam is swept across the screen,


one row at a time from top to bottom.
Raster scan Display

The refresh rate (or "vertical refresh rate", "vertical scan rate") is the number of times per
second that a raster-based display device redraws images.

Refresh rates for CRT monitors include 60, 75, and 85 Hz.
Raster- Scan Displays….
▪ Electron beam sweeps across the screen one row at a time from top to
bottom referred to as a scan line
▪ At the end of each scan line, the electron beam returns to the left side of
the screen to display the next scan line (horizontal retrace)
▪ At the end of each frame, the electron beam returns to the top-left
corner of the screen to display the next frame (vertical retrace)

Scan line

Horizontal Vertical
retrace retrace

41
Raster Scan System
• Picture definition is stored in a memory area called the refresh
buffer or frame buffer.

• This memory area holds the set of intensity values for


all the screen points.

• Stored intensity values are then retrieved from the refresh buffer
and "painted" on the screen one row (scan line) at a time .

• In addition to the central processing unit, or CPU, a special-purpose


processor, called the video controller or display controller, is used to
control the operation of the display device.
Basic video controller refresh operations
Raster -Scan Display Processor
Raster Scan Vs Random
Scan
• Advantages of Raster Displays
– lower cost
– filled regions/shaded images cheaper
– colours, textures, realism
– unlimited complexity of picture: whatever you put in
refresh buffer

• Disadvantages of Raster Displays


– a discrete representation, continuous primitives must be
scan-converted (i.e. fill in the appropriate scan lines)
– Aliasing or "jaggies" arises due to sampling error when
converting from a continuous to a discrete representation

46
Random Scan Display
• In Random-Scan Display, the electron beam is directed only to the
areas of the screen where a picture has to be drawn.

• It is also called vector display, as it draws pictures one line at a


time.

• It can draw and refresh component lines of a picture in any


specified sequence.

• Input in the form of an application program is stored in the


system memory along with a graphics package.
• The graphics package translates the
graphic commands in the application
program into a display file stored in
system memory.

• This display file is then accessed by the


display processor to refresh the screen.

• The display processor cycles through


each command in the display file
program.
Random Scan System
Raster Scan Vs Random Scan

Raster scan

Ideal line drawing

Random scan 50
▪ Advantages of Vector displays:
• very fine detail of line drawings (sometimes curves),
• Higher resolution
• geometry objects (lines)
• eg. 1000 line plot: vector display computes 2000 endpoints
• raster display computes all pixels on each line

▪ Disadvantages of Vector displays


• vector complexity limited by refresh rate
• cannot display realistic shaded scenes

51
RASTER SCAN RANDOM SCAN
While the resolution of raster scan is lesser The resolution of random scan is
or lower than random scan higher than raster scan
While the cost of raster scan is lesser than It is costlier than raster scan .
random scan.

It stores picture definition as a set of It stores picturedefinition as a set of line


intensity values of the pixels in the frame commands in the Refresh buffer.
buffer.
While in raster scan, any alteration is not so In a random scan any alteration iseasy
easy. in comparison of a raster scan.
The refresh rate is 60 to 80 frames per The refresh rate depends on the number
second and is of lines
independent of picture complexity. to be displayed i.e. 30 to 60 times per
second.
Eg: TV Sets Eg : Pen Plotter
Suppose you have a raster system designed using an 8 inches × 10 inches
screen with a resolution of 100 pixels per inch in each direction. What
frame buffer size is required if 6 bits are stored per pixel in the buffer? (4)

CST 304-CGIP
Answer
Here, resolution = 8 inch X 10 inch
First, we convert it in pixel then Now resolution = 8 X 100 by 10 X
100 pixel = 800 X 1000 pixel
1 pixel can store 6 bits

So, frame buffer size required = 8 0 0 X1 0 0 0 X6 b i t s = 600,000 bytes

= 𝟔× 𝟏𝟎5bytes.
Color CRT Monitors

• A CRT monitor displays color pictures by using a combination of phosphors


that emit different colored light.

• By combining the emitted light from the different phosphors, a range of colors
can be generated.

• The two basic techniques for producing color displays with a CRT are the
beam- penetration method and the shadow-mask method.
The beam penetration method

• It is used with random scan monitors.

• Two layers of phosphor, usually red and green, are coated onto the
inside of the CRT screen, and the displayed color depends on how far
the electron beam penetrates into the phosphor layers.

• A beam of slow electrons excites only the outer red layer.

• A beam of very fast electrons penetrates through the red layer and
excites the inner green layer.
• At intermediate beam speeds, combinations of
red and green light are emitted to show two
additional colors, orange and yellow.

• The screen color at any point, is controlled by the


beam acceleration voltage.

• Beam penetration has been an inexpensive way to


produce color in random scan monitors.

• But only four colors are possible, and the


quality of pictures is not as good as with other
methods.
Shadow-mask methods
• It is commonly used in raster scan systems (including color TV) because
they produce a much wider range of colors than the beam penetration
method.

• A shadow mask CRT has three phosphor color dots at each pixel position.

• One phosphor dot emits a red light, another emits a green light, and
the third emits a blue light.

• This type of CRT has three electron guns, one for each color dot, and a
CST 304-CGIP

shadow- mask grid just behind the phosphor-coated screen.


Delta-delta shadow mask method

CST 304-CGIP
• The three electron beams are deflected and focused as a group onto
the shadow mask, which contains a series of holes aligned with the
phosphor dot patterns.

• When the three beams pass through a hole in the shadow mask, they
activate a dot triangle, which appears as a small color spot on the
screen.

• The phosphor dots in the triangles are arranged so that each electron
beam can activate only its corresponding color dot when it passes
through the shadow mask.
• We obtain color variations in a shadow mask CRT by varying the
intensity levels of the three electron beams.

• By turning off the red and green guns, we get only the color
coming from the blue phosphor.

CST 304-CGIP
• The color we see depends on the amount of excitation of the red, green,
and blue phosphors.

• A white area is the result of activating all three dots with equal intensity.

• Yellow is produced with the green and red dots only,


• magenta is produced with the blue and red dots,
• cyan shows up when blue and green are activated equally.

CST 304-CGIP
63
64
Direct-View Storage Tubes
• An alternative method for maintaining a screen image is to store
the picture information inside the CRT instead of refreshing the
screen.

• A direct-view storage tube (DVST) stores the picture information as a


charge distribution just behind the phosphor-coated screen.

• Two electron guns are used in a DVST.

• One, the primary gun, is used to store the picture pattern;

• Second, the flood gun, maintains the picture display.


Advantages over refresh CRT
• Very complex pictures can be displayed at very high resolutions
without flicker.

Disadvantages of DVST systems


• They do not display color.
•The erasing and redrawing process can take several seconds for a
complex picture.
Digital Differential Analyzer (DDA)
LINE DRAWING ALGORITHM
#define Round(a) ((int)(a+0.5))
Line Drawing Void lineDDA(int xa, int ya, int xb, int yb)
Algorithms { int dx=xb-xa, dy=yb-ya , steps, k;
float xIncrement , yIncrement , x=xa , y=ya;
DDA if(abs(dx)>abs(dy) steps=abs(dx);
else steps=abs(dy);
xIncrement=dx/(float)steps;
yIncrement=dy/(float)steps;
setPixel(Round(x) , Round(y));
for(k=0;k<steps;k++)
{ x+=xIncrement;
y+=yIncrement;
setPixel(Round(x),Round(y));
Namitha Rama chandR a n
}
Line Drawing Algorithms

Digital Differential Analyzer (DDA) Line Drawing Algorithm

•Starting coordinates = (X0, Y0) = (5, 6)


•Ending coordinates = (Xn, Yn) = (8, 12)

•m = dy / dx = (12-6) / (8-5) = 6/3=2>1

Case 2:
xk +1= xk +1/m
yk+1=yk+1
Namitha Rama chandR a n
The advantages of DDA Algorithm are-
•It is a simple algorithm.
•It is easy to implement.
•It avoids using the multiplication operation which is costly in terms of time
complexity.

The disadvantages of the DDA Algorithm are-


•There is an extra overhead of using round-off ( ) function.
•Resulted lines are not smooth because of round off( ) function.
•The points generated by this algorithm are not accurate.
Draw line from (1,1) to(8,7) using the DDA algorithm

m=(7-1)/(8-1) = 6/7 =0.9 <1 then follow case 1


increment xk+1=xk+1 and yk+1=yk+m initially plot (1,1)
No Xk+1 Yk+1 Pixel Plotted Round(Xk+1 ,
Yk+1)
1 1+6/7=1.9 Round(2,1.9)=(2,2)
1+1=2
2 1.9 +6/7=2.8 Round(3,2.8)=(3,3)
2+1=3
3 2.8 + 6/7=3.7 Round(4, 3.7)=(4,4)
3+1=4
4 3.7+6/7 =4.6 Round(5, 4.6)=(5,5)
4+1=5
5 4.6 +6/7=5.5 Round(6, 5.5)=(6,6)
5+1=6
6 5.5 +6/7=6.4 Round(7, 6.4)=(7,6)
6+1=7
7 7+1=8 6.4 + 6/7=7.3 Round(8, 7.3)=(8,7)
Draw line from (0,0) to(4,6) using the DDA algorithm

m=(6-0)/(4-0) = 6/4 =1.5>1 then follow case 2


increment yk+1=yk+1 and xk+1=xk+1/m initially plot (0,0)

No Xk+1 Yk+1 Pixel Plotted Round(Xk+1 , Yk+1)


1 0+4/6 =0.67 0+1=1 Round(0.67,1)=(1 ,1)
2 0.67+0.67=1.34 1+1=2 Round(1.34,2)=(1,2)

3 1.34+0.67=2.01 2+1=3 Round(2.01,3)=(2,3)

4 2.01+0.67=2.68 3+1=4 Round(2.68,4)=(3,4)

5 2.68+0.67=3.35 4+1=5 Round(3.35,5)=(3,5)

6 3.35+0.67=4.02 5+1=6 Round(4.02,6)=(4,6)


#include “device.h” setPixel(Round(x) , Round(y));
#define Round(a) ((int)(a+0.5)) for(k=0;k<steps;k++)
void lineDDA(int xa, int ya, int xb, int yb)
{ x+=xIncrement;
{
y+=yIncrement;
int dx=xb-xa, dy=yb-ya , steps, k;
setPixel(Round(x),Round(y));
float xIncrement , yIncrement , x=xa , y=ya;
if(abs(dx)>abs(dy)) }
steps=abs(dx); }
else
steps=abs(dy);
xIncrement=dx/(float)steps;
yIncrement=dy/(float)steps;
Bresenham’s Line Drawing
Algorithm
Bresenham’s Line Drawing Algorithm
An accurate and efficient raster line generating algorithm.
Line equation y=m.x +b ……….(1)
The y coordinate on the mathematical line at pixel column position xk +1 is calculated as
y=m(xk+1)+b ……………….(2)

then d1=y-yk
= m(xk+1)+b-yk ………………(3)

d2=(yk+1)-y
= yk+1 – m(xk+1)-b ………………(4)
The difference between d1 and d2 is

d1-d2 = m(xk+1)+b-yk - (yk+1 – m(xk+1)-b)


= 2 m(xk+1) - 2yk +2b -1 ……………(5)
Substitute m=dy/dx in equ 5
(d1-d2)dx = 2.dy(xk+1) -2yk.dx+2b.dx –dx
pk =2.dy xk – 2dx.yk +2.dy+2b.dx –dx
pk = 2.dy xk – 2dx.yk +
C
if(pk <=0 ie d1-d2 <0 ,meaning actual line lays closer to yk ,then next pixel
coordinate is (xk+1,yk) .

if(pk >0 ie d1-d2 >0 ,meaning actual line lays closer to yk+1 ,then next pixel
coordinate is (xk+1,yk+1) .

Calculate successive decision parameters


At step k+1 the decision parameter is pk+1=2.dy.xk+1-2dxyk+1 +C ………….(8)
equ(8)-equ(6)
pk+1- pk =2.dy.xk+1-2dxyk+1 +C - (2.dy xk – 2dx.yk + C)
=2.dy(xk+1-xk) -2.dx(yk+1-yk)
pk+1 = pk + 2.dy(xk+1-xk) -2.dx(yk+1-yk) …………..(9)
if pk <=0 then next pixel coordinate is (xk+1,yk) and
pk+1 = pk + 2.dy(xk+1-xk) -2.dx(yk-yk)
pk+1 = pk + 2.dy ………(10)
If pk >0 , then next pixel coordinate is (xk+1,yk+1) and
pk+1 = pk + 2.dy(xk+1-xk) -2.dx(yk+1-yk)
pk+1 = pk + 2.dy -2.dx ………..(11)
The first decision parameter P0 is evaluated at starting pixel position (x0,y0) and with m
evaluated as dy/dx ,using equation (6)
pk =2.dy xk – 2dx.yk +2.dy+2b.dx -dx
y=mx+b , b=y-mx →b=y-(dy/dx).x substitute in above equation
p0 =2.dy x0– 2dx.y0 +2.dy+2(y0-(dy/dx)x0).dx – dx
=2.dyx0 -2.dxy0 +2.dy +2dxy0 -2dyx0 –dx p0 =2.dy-dx - ………..(12)
Bresenham’s Line-Drawing Algorithm for |m|<1
1. Input the two endpoints and store the left endpoint in (x0,y0).
2. Load (x0,y0) into the frame buffer; that is plot the first point.

3. Calculate the constants dx, dy, 2dy, and 2dy–2dx and get the first value for the
decision parameter as

p0=2dy−dx
4. At each Xk along the line, starting at k = 0, perform the following test –

If pk < 0, the next point to plot is (xk+1,yk) and Pk+1 =Pk +2dy
Otherwise, the next point to plot is (xk+1,yk+1) and Pk+1=Pk+2dy-2dx
5. Repeat step 4 dx times.
Example : Draw line using Bresenham’s Line Drwaing Algorithm
Endpoints (20,10) and (30,18)
K Pk (Xk+1,yk+1)
Slope= dy/dx → (18-10) /(30-20) → 0.8 <1
0 6 (21,11)
dx=10 dy=8
1 2 (22,12)
P0 =2dy-dx →2x 8 -10 =6
2 -2 (23,12)
2dy=16 3 14 (24,13)

4 10 (25,14)
2dy-2dx=-4
5 6 (26,15)
Initial plot point(x0,y0) =(20,10)
6 2 (27,16)

7 -2 (28,16)

8 14 (29,17)

9 10 (30,18)
Example : Draw line using Bresenham’s Line Drwaing Algorithm
Endpoints (9,18) and (14,22)

Slope= dy/dx → (22-18) /(14-9) → 4/5→0.8 <1

dx=5 dy=4

P0 =2dy-dx →2x 4 -5=3

2dy=2 x 4=8

2dy-2dx=8-10=-2
Advantages of Bresenham's Algorithm

•It is easy to implement.


•It is fast and incremental.
•It executes fast but less faster than DDA Algorithm.
•The points generated by this algorithm are more accurate than DDA
Algorithm.
•It uses fixed points only.

Disadvantages of Bresenham's Algorithm

•It also does not provide smooth lines though accuracy has been improved.
•Less faster than DDA Algorithm.
CIRCLE DRAWING ALGORITHM
Properties of Circles
• A circle is defined as the set of points that are all at a given
distance r from a center position (xc,yc).
• This distance relationship is expressed by the Pythagorean
theorem in Cartesian coordinates as,
(𝒙 −𝐱c)2 +(𝒚 −𝐲c)2=r2
We can use this equation to calculate the positions of points on a
circle by stepping along the x axis in unit steps and calculating
the corresponding y values at each position as ,
y=yc+-√ r2 -(𝒙 −𝐱c)2
But this is not the best method for getting a circle.
One problem with this approach is that it involves considerable
computation at each step.
• Another method is to calculate the points along the circular
boundary using polar coordinates r and θ.
• Expressing the circle equation in parametric polar form yields the pair of
equation.
x=xc+r cos θ
y=yc+r sin θ

• So we have 2 circle generating algorithm


1. Midpoint circle algorithm
2. Bresenham’s algorithm.
MID POINT CIRCLE DRAWING
ALGORITHM
Q1(x,y) Q2(-x,y) Q3(-x,-y) Q4(x,-y)

(1,10) (-1,10) (-1,-10) (1,-10)


(2,10) (-2,10) (-2,-10) (2,-10)
(3,10) (-3,10) (-3,-10) (3,-10)
(4,9) (-4,9) (-4,-9) (4,-9)
(5,9) (-5,9) (-5,-9) (5,-9)
(6,8) (-6,8) (-6,-8) (6,-8)
(7,7) (-7,7) (-7,-7) (7,-7)
(8,6) (-8,6) (-8,-6) (8,-6)
(9,5) (-9,5) (-9,-5) (9,-5)
(9,4) (-9,4) (-9,-4) (9,-4)
(10,3) (-10,3) (-10,-3) (10,-3)
(10,2) (-10,2) (-10,-2) (10,-2)
(10,1) (-10,1) (-10,-1) (10,-1)
Use mid-point circle drawing algorithm to plot a circle whose
radius =20 units and center at (50,30).
THANK YOU

You might also like