SlideShare a Scribd company logo
1 of 26
Raster Scan Graphics
Dheeraj S Sadawarte
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
1
INTRODUCTION
2
 Scan conversion is a general form for drawing
methods, which create raster images according to
picture primitives.
 The term is mainly used for drawing methods for 2D
picture elements or primitives such as lines, polygons
and text.
 The process to determine which pixel provides the
best approximation to shape the object is called as
rasterization, and when such procedure is combined
with picture generation using scan line is called as
Scan Conversion.
 Scan conversion of any object requires scan
conversion of lines and curves.Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Digital differential analyzer(DDA)
Algorithm
3
1: Input the coordinates of the two end points A(x1,y1) &
B(x2,y2) for the line AB respectively.
2: Calculate dx=x2-x1 & dy=y2-y1
3: Calculate the length L
if abs(x2-x1) >= abs(y2-y1) then
L=abs(x2-x1)
else
L=abs(y2-y1)
4: Calculate the incremental factor
dx=(x2-x1)/L & dy=(y2-y1)/L
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
4
5: Initialize the initial point on the line & plot
xnew = x1 + 0.5 * (sign ∆x) &
ynew = y1 + 0.5 * (sign ∆x)
The values are rounded using the factor of 0.5
rather than truncating so that the central pixel
addressing is handled correctly.
6: [Obtain the new pixel on the line & plot the same]
Initialize i =1
Digital differential analyzer(DDA)
Algorithm
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
5
While(i<=L)
{
xnew=xnew + ∆x
ynew = ynew + ∆ y
plot(Integer xnew , Integer ynew)
i=i+1
}
7: Finish
Digital differential analyzer(DDA)
Algorithm
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
6
 Advantages :
 Simple & fast
 Does not require special skills for implementing it in
any programming language.
 Disadvantage:
 Though this method is fast ,accumulation of rounding
off errors may drift the pixel away from the actual
pixels.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Examples
7
 Consider the line from (0,0) to (4,6). Use DDA to
rasterizing this line.
 Consider line from (4,4) to (7,9). Use DDA to
rasterizing this line
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Bresenham’s Line Drawing
Algorithm
8
 The Bresenham’s algorithm uses only integer
addition, subtraction and multiplication by 2
 And we know that computer can perform integer
addition and subtraction very rapidly.
 The computer is also time efficient when
performing integer multiplication by 2.
 The basic principle of Bresenham’s algorithm is
to select the optimum raster locations to
represent a straight line.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Bresenham’s Line Drawing Algorithm
9
 To accomplish this the algorithm always
increments either x or y by one unit depending
upon the slope of the line.
 The increment in other variable is determined by
examining the distance between the actual line
location and the nearest pixel.
 This distance is called decision variable or error.
 The error term is initially set as e=2*∆y- ∆x.
 Let us study the algorithm now:
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Algorithm:
10
1. Read the coordinates of the two end points (x1,y1)
& (x2,y2) such that they are not equal.(if equal then
plot that point and exit)
2. ∆x=│x2-x1│ and ∆y=│y2-y1│.
3. Initialize the starting point i.e x=x1 and y=y1.
4. Calculate e= 2∆y-∆x
5. Initialize i=1.
6. Plot(x,y)
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
11
7. While(e≥0)
{
y=y+1
e=e-2*∆x
}
x=x+1
e=e+2*∆y
8. i=i+1
9. if(i≤∆x) then go to step 6.
10. Stop.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Basic Concepts in Circle Drawing
12
 Circle is a symmetrical figure.
 The shape of the circle is similar in each
quadrant
 It has eight-way symmetry
Plot (x,y) Plot (-x,y)
Plot (y,x) Plot (y, -x)
Plot (-x,-y) Plot (x,-y)
Plot (-y,-x) Plot (-y,x)
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Representation of Circle
13
 Polynomial Method
 x2 + y2 = r2
 Trigonometric
Method
x= r cos Ө
Y = r sin Ө
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Bresenham’s Circle drawing
Algorithm:
14
 The Bresenham’s circle drawing algorithm considers
the eight way of the symmetry of the circle to
generate it.
 It plots 1/8th part of the circle i.e. from 90ᵒ to 45ᵒ.
 As circle is drawn from 90ᵒ to 45ᵒ,the x moves in x
direction and y moves in the negative direction.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Bresenham’s Circle drawing
Algorithm:
15 Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
16
 Distance of pixel A and B from origin
 Now, the distances of pixel A and B from true circle
are
 To avoid square root term
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
17
 We find that δA is always positive and δB is
always negative. Therefore we define decision
variable di
di = δA + δB
 If δA < δB (di < 0) then only x is incremented,
otherwise x is incremented and y is
decremented.
 Equation for di at starting point x=0, y=r
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Algorithm to plot 1/8 of the circle:
18
1. Read the radius (r) of the circle.
2. Initialize the decision variable. d=3-2r
3. Initialize the starting point x=0 and y=r.
4. Do{
plot(x,y)
if(d<0) then {
d=d+4x+6
}
else {
d=d+4(x-y)+10
y=y-1 }
x=x+1
}while(x<y)
5. Stop.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Polygon
19
 Polyline is a chain of connected line segments. It is
specified by giving the vertices P0, P1, P2..and so on.
 The first vertex is called initial point and last is called
terminal point.
P0
P1
P2
P3
P4
P5
P6
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Polygon
20
 When initial point and terminal point of any polyline
is same (when polyline is closed) then it is called
polygon.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Types of Polygon
21
1. Convex polygon is a polygon in which the line
segment joining any two points within the polygon lies
completely inside the polygon
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Types of Polygon
22
2. Concave polygon is a polygon in which the line
segment joining any two points within the polygon may
not lie completely inside the polygon.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
23
Polygon Filling
Types of filling
Solid-fill
All the pixels inside the polygon’s boundary are
illuminated.
Pattern-fill
the polygon is filled with an arbitrary predefined
pattern.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
24
Polygon Representation
The polygon can be represented by listing its n
vertices in an ordered list.
P = {(x1, y1), (x2, y2), ……., (xn, yn)}.
The polygon can be displayed by drawing a line
between (x1, y1), and (x2, y2), then a line between
(x2, y2), and (x3, y3), and so on until the end vertex.
In order to close up the polygon, a line between (xn,
yn), and (x1, y1) must be drawn.
One problem with this representation is that if we
wish to translate the polygon, it is necessary to
apply the translation transformation to each vertex
in order to obtain the translated polygon.Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
25
Polygon Representation
For objects described by many polygons with many
vertices, this can be a time consuming process.
One method for reducing the computational
time is to represent the polygon by the (absolute)
location of its first vertex, and represent
subsequent vertices as relative positions from the
previous vertex. This enables us to translate the
polygon simply by changing the coordinates of the
first vertex.
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
Dheeraj S Sadawarte
https://dheerajsadawarte.blogspot.com
26
Download complete presentation in ppt
format from.....
https://dheerajsadawarte.blogspot.com/2019/
08/raster-scan-graphics-computer-
graphics.html

More Related Content

Recently uploaded

會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 

Recently uploaded (20)

demyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptxdemyelinated disorder: multiple sclerosis.pptx
demyelinated disorder: multiple sclerosis.pptx
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
Envelope of Discrepancy in Orthodontics: Enhancing Precision in Treatment
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Championnat de France de Tennis de table/
Championnat de France de Tennis de table/Championnat de France de Tennis de table/
Championnat de France de Tennis de table/
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Raster scan graphics (line drawing, circle drawing, polygon, character generation)

  • 1. Raster Scan Graphics Dheeraj S Sadawarte Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com 1
  • 2. INTRODUCTION 2  Scan conversion is a general form for drawing methods, which create raster images according to picture primitives.  The term is mainly used for drawing methods for 2D picture elements or primitives such as lines, polygons and text.  The process to determine which pixel provides the best approximation to shape the object is called as rasterization, and when such procedure is combined with picture generation using scan line is called as Scan Conversion.  Scan conversion of any object requires scan conversion of lines and curves.Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 3. Digital differential analyzer(DDA) Algorithm 3 1: Input the coordinates of the two end points A(x1,y1) & B(x2,y2) for the line AB respectively. 2: Calculate dx=x2-x1 & dy=y2-y1 3: Calculate the length L if abs(x2-x1) >= abs(y2-y1) then L=abs(x2-x1) else L=abs(y2-y1) 4: Calculate the incremental factor dx=(x2-x1)/L & dy=(y2-y1)/L Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 4. 4 5: Initialize the initial point on the line & plot xnew = x1 + 0.5 * (sign ∆x) & ynew = y1 + 0.5 * (sign ∆x) The values are rounded using the factor of 0.5 rather than truncating so that the central pixel addressing is handled correctly. 6: [Obtain the new pixel on the line & plot the same] Initialize i =1 Digital differential analyzer(DDA) Algorithm Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 5. 5 While(i<=L) { xnew=xnew + ∆x ynew = ynew + ∆ y plot(Integer xnew , Integer ynew) i=i+1 } 7: Finish Digital differential analyzer(DDA) Algorithm Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 6. 6  Advantages :  Simple & fast  Does not require special skills for implementing it in any programming language.  Disadvantage:  Though this method is fast ,accumulation of rounding off errors may drift the pixel away from the actual pixels. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 7. Examples 7  Consider the line from (0,0) to (4,6). Use DDA to rasterizing this line.  Consider line from (4,4) to (7,9). Use DDA to rasterizing this line Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 8. Bresenham’s Line Drawing Algorithm 8  The Bresenham’s algorithm uses only integer addition, subtraction and multiplication by 2  And we know that computer can perform integer addition and subtraction very rapidly.  The computer is also time efficient when performing integer multiplication by 2.  The basic principle of Bresenham’s algorithm is to select the optimum raster locations to represent a straight line. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 9. Bresenham’s Line Drawing Algorithm 9  To accomplish this the algorithm always increments either x or y by one unit depending upon the slope of the line.  The increment in other variable is determined by examining the distance between the actual line location and the nearest pixel.  This distance is called decision variable or error.  The error term is initially set as e=2*∆y- ∆x.  Let us study the algorithm now: Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 10. Algorithm: 10 1. Read the coordinates of the two end points (x1,y1) & (x2,y2) such that they are not equal.(if equal then plot that point and exit) 2. ∆x=│x2-x1│ and ∆y=│y2-y1│. 3. Initialize the starting point i.e x=x1 and y=y1. 4. Calculate e= 2∆y-∆x 5. Initialize i=1. 6. Plot(x,y) Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 11. 11 7. While(e≥0) { y=y+1 e=e-2*∆x } x=x+1 e=e+2*∆y 8. i=i+1 9. if(i≤∆x) then go to step 6. 10. Stop. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 12. Basic Concepts in Circle Drawing 12  Circle is a symmetrical figure.  The shape of the circle is similar in each quadrant  It has eight-way symmetry Plot (x,y) Plot (-x,y) Plot (y,x) Plot (y, -x) Plot (-x,-y) Plot (x,-y) Plot (-y,-x) Plot (-y,x) Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 13. Representation of Circle 13  Polynomial Method  x2 + y2 = r2  Trigonometric Method x= r cos Ө Y = r sin Ө Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 14. Bresenham’s Circle drawing Algorithm: 14  The Bresenham’s circle drawing algorithm considers the eight way of the symmetry of the circle to generate it.  It plots 1/8th part of the circle i.e. from 90ᵒ to 45ᵒ.  As circle is drawn from 90ᵒ to 45ᵒ,the x moves in x direction and y moves in the negative direction. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 15. Bresenham’s Circle drawing Algorithm: 15 Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 16. 16  Distance of pixel A and B from origin  Now, the distances of pixel A and B from true circle are  To avoid square root term Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 17. 17  We find that δA is always positive and δB is always negative. Therefore we define decision variable di di = δA + δB  If δA < δB (di < 0) then only x is incremented, otherwise x is incremented and y is decremented.  Equation for di at starting point x=0, y=r Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 18. Algorithm to plot 1/8 of the circle: 18 1. Read the radius (r) of the circle. 2. Initialize the decision variable. d=3-2r 3. Initialize the starting point x=0 and y=r. 4. Do{ plot(x,y) if(d<0) then { d=d+4x+6 } else { d=d+4(x-y)+10 y=y-1 } x=x+1 }while(x<y) 5. Stop. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 19. Polygon 19  Polyline is a chain of connected line segments. It is specified by giving the vertices P0, P1, P2..and so on.  The first vertex is called initial point and last is called terminal point. P0 P1 P2 P3 P4 P5 P6 Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 20. Polygon 20  When initial point and terminal point of any polyline is same (when polyline is closed) then it is called polygon. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 21. Types of Polygon 21 1. Convex polygon is a polygon in which the line segment joining any two points within the polygon lies completely inside the polygon Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 22. Types of Polygon 22 2. Concave polygon is a polygon in which the line segment joining any two points within the polygon may not lie completely inside the polygon. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 23. 23 Polygon Filling Types of filling Solid-fill All the pixels inside the polygon’s boundary are illuminated. Pattern-fill the polygon is filled with an arbitrary predefined pattern. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 24. 24 Polygon Representation The polygon can be represented by listing its n vertices in an ordered list. P = {(x1, y1), (x2, y2), ……., (xn, yn)}. The polygon can be displayed by drawing a line between (x1, y1), and (x2, y2), then a line between (x2, y2), and (x3, y3), and so on until the end vertex. In order to close up the polygon, a line between (xn, yn), and (x1, y1) must be drawn. One problem with this representation is that if we wish to translate the polygon, it is necessary to apply the translation transformation to each vertex in order to obtain the translated polygon.Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 25. 25 Polygon Representation For objects described by many polygons with many vertices, this can be a time consuming process. One method for reducing the computational time is to represent the polygon by the (absolute) location of its first vertex, and represent subsequent vertices as relative positions from the previous vertex. This enables us to translate the polygon simply by changing the coordinates of the first vertex. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com
  • 26. Dheeraj S Sadawarte https://dheerajsadawarte.blogspot.com 26 Download complete presentation in ppt format from..... https://dheerajsadawarte.blogspot.com/2019/ 08/raster-scan-graphics-computer- graphics.html