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

Module 1-Complete PDF

The document provides an overview of basic concepts in computer graphics, including types of graphics (interactive and non-interactive), applications such as education, CAD, and entertainment, and the technology behind display devices like CRT and raster scan systems. It discusses the components of CRT, how images are drawn, and the differences between raster and random scan displays. Additionally, it introduces line drawing algorithms like DDA and Bresenham's for rendering lines in graphics.

Uploaded by

xocije3152
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)
4 views

Module 1-Complete PDF

The document provides an overview of basic concepts in computer graphics, including types of graphics (interactive and non-interactive), applications such as education, CAD, and entertainment, and the technology behind display devices like CRT and raster scan systems. It discusses the components of CRT, how images are drawn, and the differences between raster and random scan displays. Additionally, it introduces line drawing algorithms like DDA and Bresenham's for rendering lines in graphics.

Uploaded by

xocije3152
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/ 136

Module 1

Basic Concepts in Computer Graphics


• Computer graphics is an art of drawing
pictures, lines, charts, etc. using computers
with the help of programming.
• It involves displaying, manipulating and
storing of picture and experimental data for
proper visualization using a computer.
• Computer graphics is made up of number of
pixels. Pixel is the smallest graphical picture or
unit represented on the computer screen.
Basically there are two types of computer graphics
namely.
• 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 control over the image, i.e., the user
cannot make any change in the rendered images.
One example of its Titles shown on T.V.
• It 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 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.
Applications of Computer Graphics
1) Education and Training: Computer-generated
model of the physical, financial and economic
system is often used as educational aids. Model of
physical systems, physiological system, population
trends or equipment can help trainees to
understand the operation of the system.
• For some training applications, particular systems
are designed. For example Flight Simulator.
Flight Simulator: It helps in giving training to the
pilots of airplanes. These pilots spend much of
their training not in a real aircraft but on the
ground at the controls of a Flight Simulator.
Advantages:
– Fuel Saving
– Safety
– Ability to familiarize the training with a large
number of the world's airports.
3)Computer Aided Design: CAD methods are used
in the design of buildings, automobiles, aircraft,
watercraft, spacecraft, computers textiles etc.
4)Presentation Graphics: Example of presentation
Graphics are bar charts, line graphs, pie charts and
other displays showing relationships between
multiple parameters. Presentation Graphics is
commonly used to summarize
• Financial Reports
• Statistical Reports
• Mathematical Reports
• Scientific Reports
• Economic Data for research reports
• Managerial Reports
• Consumer Information Bulletins
• And other types of reports
4)Computer Art: Computer Graphics are also used
in the field of commercial arts. It is used to generate
television and advertising commercial.
5)Entertainment: Computer Graphics are now
commonly used in making motion pictures, music
videos and television shows.
6)Visualization: It is used for visualization of
scientists, engineers, medical personnel, business
analysts for the study of a large amount of
information.
7)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.

8)Graphical User Interfaces: interfaces displays menus


and icons for selection of processing options or
parameter values. An icon is a graphical symbol that is
designed to look like the processing option it represents.
A major component of a GUI is a window manager that
allows a user to display multiple-window area.
• Example of Computer Graphics Packages:
– LOGO
– COREL DRAW
– AUTO CAD
– 3D STUDIO
– CORE
– GKS (Graphics Kernel System)
– PHIGS
– CAM (Computer Graphics Metafile)
– CGI (Computer Graphics Interface)
Display Devices:
The most commonly used display device is a video
monitor. The operation of most video monitors
based on CRT (Cathode Ray Tube).
The following display devices are used:
1. Refresh Cathode Ray Tube
2. Random Scan and Raster Scan
3. Color CRT Monitors
4. Direct View Storage Tubes
5. Flat Panel Display
Cathode Ray Tube
• The primary output device in a graphical system
is the video monitor. The main element of a video
monitor is the Cathode Ray Tube (CRT).
The operation of CRT is very simple −
• The electron gun emits a beam of electrons
(cathode rays).
• The electron beam passes through focusing and
deflection systems that direct it towards specified
positions on the phosphor-coated screen.
• When the beam hits the screen, the phosphor
emits a small spot of light at each position
contacted by the electron beam.
• It redraws the picture by directing the electron
beam back over the same screen points
quickly.
Components of CRT:

Main Components of CRT are:


1. Electron Gun: Electron gun consisting of a series
of elements, primarily a heating filament
(heater) and a cathode. The electron gun creates
a source of electrons which are focused into a
narrow beam directed at the face of the CRT.
2. Control Electrode: It is used to turn the electron
beam on and off.
3. Focusing system: It is used to create a clear
picture by focusing the electrons into a narrow
beam.
4.Deflection Yoke: It is used to control the
direction of the electron beam. It creates an
electric or magnetic field which will bend the
electron beam as it passes through the area. In a
conventional CRT, the yoke is linked to a sweep
or scan generator. The deflection yoke which is
connected to the sweep generator creates a
fluctuating electric or magnetic potential.
5. Phosphorus-coated screen: The inside front
surface of every CRT is coated with phosphors.
Phosphors glow when a high-energy electron
beam hits them. Phosphorescence is the term
used to characterize the light given off by a
phosphor after it has been exposed to an
electron beam.
• How to control the intensity of the beam?
1. by setting voltage levels on the control grid, a
metal cylinder that fits over the cathode.
2. High negative voltage applied to the control grid
will shut off the beam by repelling electrons and
stopping them from passing through the small
hole at the end of the control grid structure
3. A smaller negative voltage on the control grid
simply decreases the number of electrons
striking the phosphor coating on the screen.
• How to focus the beam to a single point on
the Phosphor screen?
• Electron beam passes through a positively
charged metal cylinder that forms an
electrostatic lens. Then electrostatic lens
focuses the electron beam at the center of the
screen.
• – An additional focusing system is used to
focus the beam.
• How to deflect the beams into different
locations in the screen?
• Cathode-ray tubes are now commonly
constructed with magnetic deflection coils
mounted on the outside of the CRT envelope.
Two pairs of coils are used, with the coils in each
pair mounted on opposite sides of the neck of
the CRT envelope. One pair is mounted on the
top and bottom of the neck and the other pair is
mounted on opposite sides of the neck.
• The magnetic field produced by each pair of coils
results in a traverse deflection force that is
perpendicular both to the direction of the
magnetic field and to the direction of travel of
the electron beam.
• Horizontal deflection is achieved with one pair of
coils, and vertical deflection by the other pair.
The proper deflection amounts are attained by
adjusting the current through the coils.
• When electrostatic deflection is used, two
pairs of parallel plates are mounted inside the
CRT envelope. One pair of plates is mounted
horizontally to control the vertical deflection,
and the other pair is mounted vertical to
control horizontal deflection.
• Important Terms in CRT
• Persistance :-Time taken for the emitted light
from the phosphor to decay to one-tenth of its
original intensity.
• Resolution:- Maximum number of pixels that can
be represented on the screen without
overlapping
• Aspect Ratio :- Ratio of vertical points to
horizontal points necessary to produce equal
length lines in both directions on the screen.
Mod 1-part 2
Raster Scan
• In a raster scan system, the electron beam is swept
across the screen, one row at a time from top to
bottom. As the electron beam moves across each row,
the beam intensity is turned on and off to create a
pattern of illuminated spots.
• Picture definition is stored in 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.
• Each screen point is referred to as a pixel
(picture element) or pel. At the end of each
scan line, the electron beam returns to the left
side of the screen to begin displaying the next
scan line.
• Picture is stored in a two dimensional matrix
where each element corresponds to each pixel
on the screen.
• Frame buffer stores information in a two
dimensional matrix
• Black and white picture need only one bit
required to store ‘0’ for black or 1 for white
and in this case buffer will be referred as
bitmap
• Colour pictures obviously multiple bits are
required for each pixel position depending on
the possible number of colours for example to
show 256 colours 8 bits will be required for
each pixel and in case if multiple bits are used
for one pixel frame buffer will be referred as
pixmap.
• How Images are drawn?
• The drawing is done in a line-by-line fashion.
• Drawing each line from left to right it reaches
at the left end of the next line to draw next
line referred as horizontal retrace.
• After completing all lines in horizontal fashion
it again reaches the top left corner to start
redrawing the image (that is for refreshing)
and this is called vertical retrace.
• How to avoid Flickering in Raster Scan
Display?
• It can be avoided by refreshing ie, vertical
retrace takes 1/60th of a second to avoid
flickering. There are two other ways to avoid
flickering.
– Interlaced technique.
– Non-interlaced technique.
• Interlaced Technique
• Interlaced display beam completes scanning in
two passes. In one pass only odd lines are
drawn and in the second pass even lines are
drawn. Interlacing provides effect of double
refresh rate by completing half of the lines in
half of the time. Therefore, in systems with
low refresh rates interlacing helps avoid
flickering.
Raster Scan Systems Architecture
• In addition to CPU, a special-purpose processor called
video controller or display controller, is used to control
the operation of the display device.
• Frame buffer can be anywhere in the system memory,
and the video controller accesses the frame buffer to
refresh the screen.
• The video controller is given direct access to the frame
buffer memory to refresh the screen.
• Frame buffer locations, and the corresponding screen
positions, are referenced in Cartesian coordinates.
Refresh operation in video Controller

• Two registers are used to store the


coordinates of the screen pixels. Initially, the x
register is set to 0 and the y register is set to
ymax. The value stored in the frame buffer for
this pixel position is then retrieved and used
to set the intensity of the CRT beam. Then the
x register is incremented by 1, and the process
repeated for the next pixel on the top scan
line.
• This procedure is repeated for each pixel along the next
line by resetting x register to 0 and decrementing the y
register by 1.
• Pixels along this scan line are then processed in turn,
and the procedure is repeated for each successive scan
line. After cycling through all pixels along the bottom
scan line y=0, the video controller resets to the first
pixel position on the top scan line and the refresh
process starts over. To speed up pixel processing, video
controllers can retrieve multiple pixel values from the
refresh buffer on each pass.
• Advantages:
• Realistic image
• Million Different colors to be generated
• Shadow Scenes are possible.

• Disadvantages:
• Low Resolution
• Expensive
Mod 1-part 3
RANDOM SCAN (VECTOR SCAN)
• In this technique, the electron beam is directed
only to the part of the screen where the picture is
to be drawn rather than scanning from left to
right and top to bottom as in raster scan. It is also
called vector display, stroke-writing display, or
calligraphic display.
• Picture definition is stored as a set of line-
drawing commands in an area of memory
referred to as the refresh display file, display list,
display program or simply refresh buffer.
• To display a specified picture, the system cycles
through the set of commands in the display file,
drawing each component line in turn.
• After all the line-drawing commands are
processed, the system cycles back to the first line
command in the list.
• Random-scan displays are designed to draw all
the component lines of a picture 30 to 60 times
each second.
• Random-scan systems are designed for line-drawing
applications and cannot display realistic scenes.
• Since picture definition is stored as a set of line-
drawing instructions and not as a set of intensity values
for all screen points, vector displays generally have
higher resolution than raster systems.
• Also, vector displays produce smooth line drawings
because the CRT beam directly follows the line path.
• A raster system, in contrast, produces jagged lines that
are plotted as discrete point sets.
• Advantages:
• A CRT has the electron beam directed only to the parts
of the screen where an image is to be drawn.
• Produce smooth line drawings.
• High Resolution

• Disadvantages:
1. Random-Scan monitors cannot display realistic shades
scenes.
Architecture of Random Scan Systems

• An application program is input and stored in


the system memory along with a graphics
package.
• Graphics commands in the application
program are translated by the graphics
package into a display file stored in the 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 once
during every refresh cycle.
• Sometimes the display processor in a random
scan system is referred to as a display
processing unit or graphics controller.
Differentiate between Random and
Raster Scan Display:
Random Scan Raster Scan

1. It has high Resolution 1. Its resolution is low.

2. It is more expensive 2. It is less expensive

3. Any modification if needed is easy 3.Modification is tough

4. Solid pattern is tough to fill 4.Solid pattern is easy to fill

5. Refresh rate depends on resolution 5. Refresh rate does not depend on the
picture.
6. Only screen with view on an area is displayed. 6. Whole screen is scanned.

7. Beam Penetration technology come under it. 7. Shadow mark technology came under this.

8. It does not use interlacing method. 8. It uses interlacing

9. It is restricted to line drawing 9. It is suitable for realistic display.

applications
Line Drawing Line

• A line, or straight line, is, roughly speaking, an


(infinitely) thin, (infinitely) long, straight
geometrical object, i.e. a curve that is long and
straight.
A line may have three forms with respect to slope
• it may have slope=1
• it may have slope<1
• It may have slope>1
There are mainly two types of Line Drawing
algorithm. They are
• DDA Line Drawing Algorithm.
• Bresenham’s Line Drawing Algorithm.
DDA Algorithm

• It can be called as digital differential analyzer


• This is also called as the incremental algorithm
• The algorithm input will be the starting and
end point of a line
• It helps to identify the intermediate pixel
between the starting and ending point.
• Here we perform calculations at each step
using the results from the preceding step.
• The characteristic of the DDA algorithm is to
take unit steps(incremented) along one
coordinate and compute the corresponding
values (derivative value) along the other
coordinate.
• The unit steps are always along the coordinate
of greatest change, e.g. if dx = 10 and dy = 5,
then we would take unit steps along x and
compute the steps along y.
Algorithm-DDA Line drawing

STEP 3 :Now we have to calculate dx and dy


dx=x2-x1
dy=y2-y1
m=dy/dx

Step 4:After calculating m check for the 3 cases that is


• Case 1: If m < 1
Then x coordinate tends to the Unit interval.
xk+1 = xk + 1
yk+1 = yk + m
• Case 2: If m > 1
Then y coordinate tends to the Unit interval.
yk+1 = yk + 1
xk+1 = xk + 1/m
• Case 3: If m = 1
Then x and y coordinate tend to the Unit interval.
xk+1 = xk + 1
yk+1 = yk + 1
EXAMPLE
• Example: A line has a starting point (1,7) and
ending point (11,17). Apply the Digital Differential
Analyzer algorithm to plot a line.
• Solution: We have two coordinates,
Starting Point = (x1, y1) = (1,7)
Ending Point = (x2, y2) = (11,17)
• Step 1: First, we calculate dx, dy and m.
dx = x2 – x1 = 11-1 = 10
dy = y2 – y1 = 17-7 = 10
m = dy/dx = 10/10 = 1
• Step 2: Now, we calculate the number of steps.
dx = dy = 10
Then, the number of steps = 10
• Step 3: We get m = 1, Third case is satisfied.
Now move to next step.

Then x and y coordinate tend to the Unit


interval(incremented).
xk+1 = xk + 1
yk+1 = yk + 1
• Step 4: We will repeat step 3 until we get the
endpoints of the line.
• Step 5: Stop.
• Advantages of DDA Algorithm
• It is the simplest algorithm
• It is a faster method for calculating pixel positions

• Disadvantages of DDA Algorithm


• Floating point arithmetic in DDA algorithm is still
time-consuming
• End point accuracy is poor
Mod 1-part 4
Bresenham’s Line Algorithm
– An accurate and efficient raster line generating
algorithm developed by Bresenham that uses only
incremental integer calculations.
– It uses only integer addition, subtraction and
multiplication by 2.
– It finds optimum raster locations to represent the
straight line.
– It always increments either x or y by one unit intervals
depending on the slope of line.
– It then increments other variable on the basis of the
distance between the actual line location and the
nearest pixel. This distance is called decision variable
or error term.
Algorithm of Bresenham’s Line
Drawing Algorithm
• Step 1: Start.
• Step 2: Now, we consider Starting point as (x1,
y1) and endingpoint (x2, y2).
• Step 3: Now, we have to calculate dx and dy.
dx = x2-x1
dy = y2-y1
m = dy/dx
• Step 4: Now, we will calculate the decision
parameter pk with following formula.
pk = 2dy-dx
• Step 5: The initial coordinates of the line
are (xk, yk), and the next coordinates are (xk+1,
yk+1). Now, we are going to calculate two cases
for decision parameter pk
Case 1: If
pk < 0
Then
pk+1 =pk +2dy
xk+1 = xk +1
yk+1 = yk
Case 2: If
pk >= 0
Then
pk+1 =pk +2dy-2dx
xk+1 =xk +1
yk+1 =yk +1
• Step 6: We will repeat step 5 until we found
the ending point of the line and the total
number of iterations =dx-1.
• Step 7: Stop.
Example: A line has a starting point (9,18) and
ending point (14,22). Apply the Bresenham’s Line
Drawing algorithm to plot a line.
Solution: We have two coordinates,
Starting Point = (x1, y1) = (9,18)
Ending Point = (x2, y2) = (14,22)
Step 1: First, we calculate dx, dy.
dx = x2 – x1 = 14-9 = 5
dy = y2 – y1 = 22-18 = 4
Step 2: Now, we are going to calculate the decision
parameter (pk)
pk = 2dy-dx
=2x4–5=3
The value of pk = 3
Step 3: Now, we will check both the cases.
If
pk >= 0
Then
Case 2 is satisfied.
Thus
pk+1 = pk +2dy-2dx =3+ (2 x 4) - (2 x 5) = 1
xk+1 =xk +1 = 9 + 1 = 10
yk+1 =yk +1 = 18 +1 = 19
Step 4: Now move to next step. We will calculate
the coordinates until we reach the end point of
the line.
dx -1 = 5 – 1 = 4
P1 = (9, 18)

P2 = (10, 19)

P3 = (11, 20)

P4 = (12, 20)

P5 = (13, 21)

P6 = (14, 22)
• Step 5: Stop.
The Coordinates of drawn lines are-
• P1 = (9, 18)
• P2 = (10, 19)
• P3 = (11, 20)
• P4 = (12, 20)
• P5 = (13, 21)
• P6 = (14, 22)
Bresenham’s Line Drawing Algorithm DDA Line Drawing Algorithm
It uses fixed point arithmetic. It uses floating point operations.
It uses only addition and subtraction in It uses multiplication and division in its
its
operators.
Operators
It is faster than DDA It is slower than Bresenham’s algorithm.

It is more efficient and much accurate It is not accurate and efficient as


than Bresenham’s algorithm.
DDA algorithm.
It is less expensive than DDA algorithm. It uses an enormous number of floating
point
multiplications so it is expensive.
It does not round off but takes It round off the coordinates to integer that
theincremental value in its operation. is nearest to the line. Rounding off of the
pixel position obtained by multiplication or
division causes an accumulation of error
in
the proceeding pixels.
Mod 1-part 5
Mid Point Circle Drawing Algorithm
• The mid-point circle drawing algorithm is an
algorithm used to determine the points needed
for rasterizing a circle.

• We use the mid-point algorithm to calculate all


the perimeter points of the circle in the first
octant and then print them along with their
mirror points in the other octants. This will work
because a circle is symmetric about its centre.
Procedure-
• Given-
Centre point of Circle = (X0, Y0)
Radius of Circle = R
• The points generation using Mid Point Circle
Drawing Algorithm involves the following
steps-
Step-01:
• Assign the starting point coordinates (X0, Y0) as-
• X0 = 0
• Y0 = R

Step-02:
• Calculate the value of initial decision parameter
P0 as-
• P0 = 1 – R
• Step-03:
• Suppose the current point is (Xk, Yk) and the
next point is (Xk+1, Yk+1).
• Find the next point of the first octant
depending on the value of decision parameter
Pk.
• Follow the below two cases-
Step-04:
• If the given centre point (X0, Y0) is not (0, 0), then do the following
and plot the point-
• Xplot = Xc + X0
• Yplot = Yc + Y0

Here, (Xc, Yc) denotes the current value of X and Y coordinates.


Step-05
generates all the points for one octant.
Step 6
Stop
• Algorithm calculates all the points of octant-1
and terminates.
• Now, the points of octant-2 are obtained using
the mirror effect by swapping X and Y
coordinates.
• Now, the points for rest of the part are
generated by following the signs of other
quadrants.
• The other points can also be generated by
calculating each octant separately.
• Given the centre point co-ordinates of the
circle (4,4) and radius as 10.Generate all the
points to form a circle.
Xplot = Xc + X0
Yplot = Yc + Y0
• Draw a circle having radius as 10 and center of
circle as (100,100).
• Use midpoint circle drawing algorithm to plot
a circle whose radius =20 units and center is
(50, 30).
Advantages of Midpoint circle drawing algorithm
• It is a powerful and efficient algorithm.
• The midpoint circle drawing algorithm is easy to
implement.
• It is also an algorithm based on a simple circle
equation (x2 + y2 = r2).
• This algorithm helps to create curves on a raster
display.
Disadvantages of Midpoint circle drawing algorithm
• It is a time-consuming algorithm.
• Sometimes the points of the circle are not accurate.
Mod 1-part 6
Bresenhams circle drawing algorithm

• It is an efficient method as it avoids trigonometric


and square root calculations by adopting only
integer operation involving squares of the pixel
separation distances.
• It considers the 8-way symmetry of the circle.
• It plots (1/8)th part of the circle.
• Here x moves in positive direction and y moves
in negative direction
algorithm
Given-
Centre point of Circle = (X0, Y0)
Radius of Circle = R
The points generation using Bresenham Circle
Drawing Algorithm involves the following steps-

Step-01:
Assign the starting point coordinates (X0, Y0) as-
• X0 = 0
• Y0 = R
Step-02:
• Calculate the value of initial decision parameter
P0 as-
• P0 = 3 – 2 x R
Step-03:
Suppose the current point is (Xk, Yk) and the next
point is (Xk+1, Yk+1).
Find the next point of the first octant depending on
the value of decision parameter Pk.
• Follow the below two cases-
Step-04:
• If the given centre point (X0, Y0) is not (0, 0),
then do the following and plot the point-
Xplot = Xc + X0
Yplot = Yc + Y0
• Here, (Xc, Yc) denotes the current value of X
and Y coordinates.
• Step-05:
• Keep repeating Step-03 and Step-04 until
Xplot => Yplot.
• Step-06:
• Step-05 generates all the points for one
octant.
• To find the points for other seven octants,
follow the eight symmetry property of circle.
Problem-01:
Given the centre point coordinates (0, 0) and
radius as 8, generate all the points to form a
circle.
solution
Given-
Centre Coordinates of Circle (X0, Y0) = (0, 0)
Radius of Circle = 8
Step-01:
Assign the starting point coordinates (X0, Y0) as-
X0 = 0
Y0 = R = 8
Step-02:
Calculate the value of initial decision parameter
P0 as-
P0 = 3 – 2 x R
P0 = 3 – 2 x 8
P0 = -13
• Step-03:
As Pinitial < 0, so case-01 is satisfied.
Thus,
Xk+1 = Xk + 1 = 0 + 1 = 1
Yk+1 = Yk = 8
Pk+1 = Pk + 4 x Xk+1 + 6 = -13 + (4 x 1) + 6 = -3
Step-04:
This step is not applicable here as the given
centre point coordinates is (0, 0).
Step-05:

Step-03 is executed similarly until Xk+1 >=


Yk+1 as follows-
• Algorithm calculates all the points of octant-1
and terminates.
• Now, the points of octant-2 are obtained using
the mirror effect by swapping X and Y
coordinates.
Advantages of Bresenham's algorithm:
• Bresenham's algorithm compacts with integers, so is
very less time and memory consuming.
• This algorithm is accurate and efficient as it evades
using round function or variable point calculations.
Disadvantages of Bresenham’s algorithm:
• This algorithm undergoes when used to create complex
and high graphical images.
• There is no significant improvement with respect to
performance.
• Problem-02:
• Given the centre point coordinates (10, 10)
and radius as 10, generate all the points to
form a circle.
Solution-
Given-
Centre Coordinates of Circle (X0, Y0) = (10, 10)
Radius of Circle = 10
Step-01:
Assign the starting point coordinates (X0, Y0) as-
X0 = 0
Y0 = R = 10
Step-02:
Calculate the value of initial decision parameter
P0 as-
P0 = 3 – 2 x R
P0 = 3 – 2 x 10
P0 = -17
• Step-03:
As Pinitial < 0, so case-01 is satisfied.
Thus,
Xk+1 = Xk + 1 = 0 + 1 = 1
Yk+1 = Yk = 10
Pk+1 = Pk + 4 x Xk+1 + 6 = -17 + (4 x 1) + 6 = -7
• Step-04:
This step is applicable here as the given centre
point coordinates is (10, 10).
• Xplot = Xc + X0 = 1 + 10 = 11
• Yplot = Yc + Y0 = 10 + 10 = 20

You might also like