尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
Polygon (Definition)
1
Polygon is a figure having many slides. It may be represented as a number of line segments end to end to form a
closed figure.
The line segments which form the boundary of polygon are called as edges or slides of polygon.
The end of the side are called the polygon vertices.
Triangle is the most simple form of polygon having three side and three vertices.
The polygon may be of any shape.
Types of Polygon
2
1. Convex
2. Concave
3. Complex
Convex
3
Convex polygon is a polygon in which if we take any points which are
surely inside the polygon and if we draw a joining these two points and
if all the points on that line lies into the polygon, then such a polygon is
called as convex polygon.
Concave
4
Concave polygon is a polygon in which if we take any two points which are
surely inside the polygon and if we draw a line joining these two points and
if all the points on that line are not lying inside the polygon, then such a
polygon is called as concave polygon.
Complex
5
In a computer graphics, a polygon which is neither convex nor concave is
referred as complex polygons.
The complex polygon includes any polygon which intersects itself of the
polygon which overlaps itself.
The complex polygon has a boundary.
Polygon Representation
6
OP X Y
6 5 5
2 7 5
2 9 3
2 7 1
2 5 1
2 3 3
2 5 5
A(5,5)
F(3,3)
E(5,1) D(7,1)
B(7,5)
C(9,3)
Inside Test Methods
7
1. Even-odd Method
2. Winding Number Method
Even - Odd Methods
8
x4,y4
x3,y3
x2,y2
x1,y1 Count even
Outside
Point ‘B’
A
Fig. 3.2.2
Fig. 3.2.3 Fig. 3.2.4
Outside
Point ‘B’
AC
Count Odd
Fig. 3.2.5
ACB
A
B C D A
Winding Number Methods
9
1
-1 1
Fig. 3.2.7
Fig. 3.2.8
Fig. 3.2.9
AB
C
1
Newly
drawn line
+1 -1
DC
B A
Winding Number Methods
10
Fig. 3.2.10 (c)
Fig. 3.2.10 (a) Fig. 3.2.10 (b)
-1
-1+1
D
AB
C
Case I
Case II
Case III
B
C
A
D
-1
-1+1
B
C D
A
-1-1
+1
Polygon Filling
11
Polygon Filling
Algorithm
1. Boundary Fill Algorithm
2. Flood Fill (Seed Fill) Algorithm
3. Edge Fill Algorithm
4. Fence Fill Algorithm
1. Scan Line Algorithm
Pixel Level Geometric Level
4-connected Method
12
In this 4 neighboring points of a current test point are tested.
These are pixel positions that are right, left, above and below of current pixels as shown in figure 2.26
8-connected Method
Here 8 neighboring pixels of current test pixel are tested.
These pixel positions are left, right, above and 4 – diagonal positions of current pixel as shown in figure
2.27
Boundary Fill Algorithm
13
bfill (x, y, newcolor)
{
current = getpixel (x, y);
if (current != newcolor)) && (current != boundarycolor)
{
putpixel (x, y, newcolor);
bfill (x+1, y, newcolor);
bfill (x-1, y, newcolor);
bfill (x, y+1, newcolor);
bfill (x, y-1, newcolor);
}
}
The following procedure illustrate a recursive method for boundary fill by using 4-connected method.
Flood Fill (Seed fill) Algorithm
14
F-fill (x, y, newcolor)
{ current = getpixel (x, y);
if (current != newcolor)
{ putpixel (x, y, newcolor);
f-fill (x-1, y, newcolor);
f-fill (x+1, y, newcolor);
f-fill (x, y-1, newcolor);
f-fill (x, y+1, newcolor);
}
}
The following procedure illustrate a recursive method for flood fill by using 4-connected method.
Scan line Algorithm
15
(0,0)
y min
y max
A(x1, y1)
B(x2,y2)
C(x3, y3)
D(x4, y4)
Fig. 3.4.1
Edge y
max
x
max
y
min
x
min
Slope
AB y2 x2 y1 x1 m1
AD y4 x4 y1 x1 m2
CD y3 x4 Y4 x4 m3
BC y2 x2 y3 x3 m4
Fig. 3.4.1
Scan line Algorithm
16
Edge y
max
x
max
y
min
x
min
Slope
AB y2 x2 y1 x1 m1
BC y2 x2 y3 x3 m4
CD y3 x3 Y4 x4 m3
AD y4 x4 y1 x1 m2
Fig. 3.4.2
y max =y2
y2-2
y2-2
y min
A(x1,y1)
B(x2, y2)
Scan line Algorithm
17
Fig. 3.4.3 Fig. 3.4.4
Edge y
max
x
max
y
min
x
min
Slope
AB y1 x1 y2 x2 m1
BC y1 x1 y5 x3 m2
CD y3 x3 Y2 x2 m3
AD y x y x m4
A(x1,y1)
D(x4,y4)
C(x3,y3)
B(x2,y2)
max
min
A
(x1,y1)
C
(x3,y3)
D(x4,y4)
B
(x2,y2)
E
(x5,y5)
Y max
Y min
Scan line Algorithm
18
Fig. 3.4.5
Fig. 3.4.6
A
C
D
B
E
P2 P3 P4P1
yp
P3
P2P1
Flood fill Vs Boundary fill Vs Edge fill Vs Fence fill Vs Scan line fill
19
Flood fill Boundary Fill Edge fill Fence Fill Scan line fill
Need Seed point to
start.
Need Seed point to
start.
Based on
complimenting the
pixels.
Based on
complimenting the
pixels.
Based on line
drawing, polygon is
filled.
Current pixels color
is compared with
new pixel color.
Current pixels color
is compared with
new pixel color and
boundary color.
Pixels which are on
right side of an edge
are getting
complemented.
Pixels which are on
right side of an edge
and to the left of
fence as well as left
side of edge and
right side of fence
are getting
complemented.
Intersection of
polygon edges are
found with the scan
line and then the
solid lines are drawn
between two such
intersection points.
Useful for polygons
having single color
boundary.
Useful for polygons
having multi color
boundary.
More number of
pixels are
unnecessarily
accessed.
Less number of
pixels are accessed
as compared to
edge fill.
Need separate
attention to handle
concave polygons.
Connected boundary fill Algorithm
boundary_fill (x, y, f_colour, b_colour)
{
if (getpixel (x, y) != b_colour && getpixel (x, y) != f_colour)
{
putpixel (x, y, f_colour);
boundary_fill (x+1, y, f_colour, b_colour);
boundary_fill (x-1, y, f_colour, b_colour);
boundary_fill (x, y+1, f_colour, b_colour);
boundary_fill (x, y-1, f_colour, b_colour);
boundary_fill (x+1, y+1, f_colour, b_colour);
boundary_fill (x-1, y-1, f_colour, b_colour);
boundary_fill (x+1, y-1, f_colour, b_colour);
boundary_fill (x-1, y+1, f_colour, b_colour);
}
}
To enhance speed of filling colour one may look for alternative of 4-connected.
In this algorithm all adjacent pixels will be consider for filling till the match is true. Algorithm is as follows :
20

More Related Content

What's hot

Frame buffer
Frame bufferFrame buffer
Frame buffer
Aparna Joshi
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
Kamal Acharya
 
Unit 3
Unit 3Unit 3
Unit 3
ypnrao
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
Mohd Arif
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
Ankit Garg
 
Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
Kamal Acharya
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
Pooja Dixit
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
Renita Santhmayora
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
Ankit Garg
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
Mohd Arif
 
Bezier curve computer graphics
Bezier curve computer graphics Bezier curve computer graphics
Bezier curve computer graphics
University of Potsdam
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
Mohd Arif
 
Segments in Graphics
Segments in GraphicsSegments in Graphics
Segments in Graphics
Rajani Thite
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
Sanu Philip
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
Mani Kanth
 
Z buffer
Z bufferZ buffer
Z buffer
AmitBiswas99
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
PrathimaBaliga
 
Graphics software
Graphics softwareGraphics software
Graphics software
Mohd Arif
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
Punyajoy Saha
 

What's hot (20)

Frame buffer
Frame bufferFrame buffer
Frame buffer
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
 
Unit 3
Unit 3Unit 3
Unit 3
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Circle generation algorithm
Circle generation algorithmCircle generation algorithm
Circle generation algorithm
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
 
Bezier curve computer graphics
Bezier curve computer graphics Bezier curve computer graphics
Bezier curve computer graphics
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Segments in Graphics
Segments in GraphicsSegments in Graphics
Segments in Graphics
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
 
Z buffer
Z bufferZ buffer
Z buffer
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
Graphics software
Graphics softwareGraphics software
Graphics software
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 

Similar to Polygons - Computer Graphics - Notes

CVGIP_Chia-Pin Tseng
CVGIP_Chia-Pin TsengCVGIP_Chia-Pin Tseng
CVGIP_Chia-Pin Tseng
Chia-Pin Tseng
 
determinants-160504230830.pdf
determinants-160504230830.pdfdeterminants-160504230830.pdf
determinants-160504230830.pdf
Praveen Kumar Verma PMP
 
determinants-160504230830_repaired.pdf
determinants-160504230830_repaired.pdfdeterminants-160504230830_repaired.pdf
determinants-160504230830_repaired.pdf
TGBSmile
 
Determinants
DeterminantsDeterminants
Determinants
Joey Valdriz
 
maths sample paper class 9 SA2
maths sample paper class 9 SA2maths sample paper class 9 SA2
maths sample paper class 9 SA2
Garvit19
 
Cbse sample-papers-class-10-maths-sa-ii-solved-4
Cbse sample-papers-class-10-maths-sa-ii-solved-4Cbse sample-papers-class-10-maths-sa-ii-solved-4
Cbse sample-papers-class-10-maths-sa-ii-solved-4
gyanpub
 
Notes and formulae mathematics
Notes and formulae mathematicsNotes and formulae mathematics
Notes and formulae mathematics
Zainonie Ma'arof
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
ShwetaShah754701
 
Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
saravana kumaar
 
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions ManualGeometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
rohalcabaye
 
Mathematics formulas
Mathematics formulasMathematics formulas
Mathematics formulas
Thanussha Ragu
 
Notes and Formulae Mathematics SPM
Notes and Formulae Mathematics SPM Notes and Formulae Mathematics SPM
Notes and Formulae Mathematics SPM
Zhang Ewe
 
Notes and-formulae-mathematics
Notes and-formulae-mathematicsNotes and-formulae-mathematics
Notes and-formulae-mathematics
Ah Ching
 
Class 9 Cbse Maths Sample Paper Term 1 Model 1
Class 9 Cbse Maths Sample Paper Term 1 Model 1Class 9 Cbse Maths Sample Paper Term 1 Model 1
Class 9 Cbse Maths Sample Paper Term 1 Model 1
Sunaina Rawat
 
2013 sp sa_2_09_mathematics_01_kvs
2013 sp sa_2_09_mathematics_01_kvs2013 sp sa_2_09_mathematics_01_kvs
2013 sp sa_2_09_mathematics_01_kvs
Yagya Malik
 
ag assign1.0.docx
ag assign1.0.docxag assign1.0.docx
ag assign1.0.docx
EmieVelasco
 
Vistas Learning-Class-Maths
Vistas Learning-Class-MathsVistas Learning-Class-Maths
Vistas Learning-Class-Maths
PavithraT30
 
Form 5 Additional Maths Note
Form 5 Additional Maths NoteForm 5 Additional Maths Note
Form 5 Additional Maths Note
Chek Wei Tan
 
Lecture filling algorithms
Lecture  filling algorithmsLecture  filling algorithms
Lecture filling algorithms
avelraj
 
Class 9 Cbse Maths Sample Paper Term 2 Model 1
Class 9 Cbse Maths Sample Paper Term 2 Model 1Class 9 Cbse Maths Sample Paper Term 2 Model 1
Class 9 Cbse Maths Sample Paper Term 2 Model 1
Sunaina Rawat
 

Similar to Polygons - Computer Graphics - Notes (20)

CVGIP_Chia-Pin Tseng
CVGIP_Chia-Pin TsengCVGIP_Chia-Pin Tseng
CVGIP_Chia-Pin Tseng
 
determinants-160504230830.pdf
determinants-160504230830.pdfdeterminants-160504230830.pdf
determinants-160504230830.pdf
 
determinants-160504230830_repaired.pdf
determinants-160504230830_repaired.pdfdeterminants-160504230830_repaired.pdf
determinants-160504230830_repaired.pdf
 
Determinants
DeterminantsDeterminants
Determinants
 
maths sample paper class 9 SA2
maths sample paper class 9 SA2maths sample paper class 9 SA2
maths sample paper class 9 SA2
 
Cbse sample-papers-class-10-maths-sa-ii-solved-4
Cbse sample-papers-class-10-maths-sa-ii-solved-4Cbse sample-papers-class-10-maths-sa-ii-solved-4
Cbse sample-papers-class-10-maths-sa-ii-solved-4
 
Notes and formulae mathematics
Notes and formulae mathematicsNotes and formulae mathematics
Notes and formulae mathematics
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
 
Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
 
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions ManualGeometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
Geometry 1st Edition Kindle Edition by Elayn Martin Gay Solutions Manual
 
Mathematics formulas
Mathematics formulasMathematics formulas
Mathematics formulas
 
Notes and Formulae Mathematics SPM
Notes and Formulae Mathematics SPM Notes and Formulae Mathematics SPM
Notes and Formulae Mathematics SPM
 
Notes and-formulae-mathematics
Notes and-formulae-mathematicsNotes and-formulae-mathematics
Notes and-formulae-mathematics
 
Class 9 Cbse Maths Sample Paper Term 1 Model 1
Class 9 Cbse Maths Sample Paper Term 1 Model 1Class 9 Cbse Maths Sample Paper Term 1 Model 1
Class 9 Cbse Maths Sample Paper Term 1 Model 1
 
2013 sp sa_2_09_mathematics_01_kvs
2013 sp sa_2_09_mathematics_01_kvs2013 sp sa_2_09_mathematics_01_kvs
2013 sp sa_2_09_mathematics_01_kvs
 
ag assign1.0.docx
ag assign1.0.docxag assign1.0.docx
ag assign1.0.docx
 
Vistas Learning-Class-Maths
Vistas Learning-Class-MathsVistas Learning-Class-Maths
Vistas Learning-Class-Maths
 
Form 5 Additional Maths Note
Form 5 Additional Maths NoteForm 5 Additional Maths Note
Form 5 Additional Maths Note
 
Lecture filling algorithms
Lecture  filling algorithmsLecture  filling algorithms
Lecture filling algorithms
 
Class 9 Cbse Maths Sample Paper Term 2 Model 1
Class 9 Cbse Maths Sample Paper Term 2 Model 1Class 9 Cbse Maths Sample Paper Term 2 Model 1
Class 9 Cbse Maths Sample Paper Term 2 Model 1
 

More from Omprakash Chauhan

Introduction to curve
Introduction to curveIntroduction to curve
Introduction to curve
Omprakash Chauhan
 
Stack - Data Structure - Notes
Stack - Data Structure - NotesStack - Data Structure - Notes
Stack - Data Structure - Notes
Omprakash Chauhan
 
Sorting and Searching - Data Structure - Notes
Sorting and Searching - Data Structure - NotesSorting and Searching - Data Structure - Notes
Sorting and Searching - Data Structure - Notes
Omprakash Chauhan
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
Omprakash Chauhan
 
Basic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - NotesBasic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - Notes
Omprakash Chauhan
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
Omprakash Chauhan
 
Basic of computer graphic - Computer Graphic - Notes
Basic of computer graphic - Computer Graphic - NotesBasic of computer graphic - Computer Graphic - Notes
Basic of computer graphic - Computer Graphic - Notes
Omprakash Chauhan
 
E-R Diagram of College Management Systems
E-R Diagram of College Management SystemsE-R Diagram of College Management Systems
E-R Diagram of College Management Systems
Omprakash Chauhan
 
Burglar Alarm Micro Project
Burglar Alarm Micro ProjectBurglar Alarm Micro Project
Burglar Alarm Micro Project
Omprakash Chauhan
 
Simple Calculator Flowchart
Simple Calculator FlowchartSimple Calculator Flowchart
Simple Calculator Flowchart
Omprakash Chauhan
 
Full Wave Rectifier (FWR) Microproject
Full Wave Rectifier (FWR) MicroprojectFull Wave Rectifier (FWR) Microproject
Full Wave Rectifier (FWR) Microproject
Omprakash Chauhan
 
A detailed study of guidelines required for presentation skills
A detailed study of guidelines required for presentation skillsA detailed study of guidelines required for presentation skills
A detailed study of guidelines required for presentation skills
Omprakash Chauhan
 
Fractional-horsepower Motor Report
Fractional-horsepower Motor ReportFractional-horsepower Motor Report
Fractional-horsepower Motor Report
Omprakash Chauhan
 
motherboard electronic components and their functions
motherboard electronic components and their functionsmotherboard electronic components and their functions
motherboard electronic components and their functions
Omprakash Chauhan
 
How To Area of irregular shape Using Integration Method.
How To Area of irregular shape Using Integration Method.How To Area of irregular shape Using Integration Method.
How To Area of irregular shape Using Integration Method.
Omprakash Chauhan
 
Process of ionization
Process of ionizationProcess of ionization
Process of ionization
Omprakash Chauhan
 
Welcome to the world of ionization
Welcome to the world of ionization Welcome to the world of ionization
Welcome to the world of ionization
Omprakash Chauhan
 
Printer
PrinterPrinter
System of units
System of unitsSystem of units
System of units
Omprakash Chauhan
 

More from Omprakash Chauhan (19)

Introduction to curve
Introduction to curveIntroduction to curve
Introduction to curve
 
Stack - Data Structure - Notes
Stack - Data Structure - NotesStack - Data Structure - Notes
Stack - Data Structure - Notes
 
Sorting and Searching - Data Structure - Notes
Sorting and Searching - Data Structure - NotesSorting and Searching - Data Structure - Notes
Sorting and Searching - Data Structure - Notes
 
Queue - Data Structure - Notes
Queue - Data Structure - NotesQueue - Data Structure - Notes
Queue - Data Structure - Notes
 
Basic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - NotesBasic of Data Structure - Data Structure - Notes
Basic of Data Structure - Data Structure - Notes
 
Line Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - NotesLine Drawing Algorithms - Computer Graphics - Notes
Line Drawing Algorithms - Computer Graphics - Notes
 
Basic of computer graphic - Computer Graphic - Notes
Basic of computer graphic - Computer Graphic - NotesBasic of computer graphic - Computer Graphic - Notes
Basic of computer graphic - Computer Graphic - Notes
 
E-R Diagram of College Management Systems
E-R Diagram of College Management SystemsE-R Diagram of College Management Systems
E-R Diagram of College Management Systems
 
Burglar Alarm Micro Project
Burglar Alarm Micro ProjectBurglar Alarm Micro Project
Burglar Alarm Micro Project
 
Simple Calculator Flowchart
Simple Calculator FlowchartSimple Calculator Flowchart
Simple Calculator Flowchart
 
Full Wave Rectifier (FWR) Microproject
Full Wave Rectifier (FWR) MicroprojectFull Wave Rectifier (FWR) Microproject
Full Wave Rectifier (FWR) Microproject
 
A detailed study of guidelines required for presentation skills
A detailed study of guidelines required for presentation skillsA detailed study of guidelines required for presentation skills
A detailed study of guidelines required for presentation skills
 
Fractional-horsepower Motor Report
Fractional-horsepower Motor ReportFractional-horsepower Motor Report
Fractional-horsepower Motor Report
 
motherboard electronic components and their functions
motherboard electronic components and their functionsmotherboard electronic components and their functions
motherboard electronic components and their functions
 
How To Area of irregular shape Using Integration Method.
How To Area of irregular shape Using Integration Method.How To Area of irregular shape Using Integration Method.
How To Area of irregular shape Using Integration Method.
 
Process of ionization
Process of ionizationProcess of ionization
Process of ionization
 
Welcome to the world of ionization
Welcome to the world of ionization Welcome to the world of ionization
Welcome to the world of ionization
 
Printer
PrinterPrinter
Printer
 
System of units
System of unitsSystem of units
System of units
 

Recently uploaded

Data Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdfData Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdf
Kamal Acharya
 
College Call Girls Kolkata 🔥 7014168258 🔥 Real Fun With Sexual Girl Available...
College Call Girls Kolkata 🔥 7014168258 🔥 Real Fun With Sexual Girl Available...College Call Girls Kolkata 🔥 7014168258 🔥 Real Fun With Sexual Girl Available...
College Call Girls Kolkata 🔥 7014168258 🔥 Real Fun With Sexual Girl Available...
Ak47
 
CSP_Study - Notes (Paul McNeill) 2017.pdf
CSP_Study - Notes (Paul McNeill) 2017.pdfCSP_Study - Notes (Paul McNeill) 2017.pdf
CSP_Study - Notes (Paul McNeill) 2017.pdf
Ismail Sultan
 
The Differences between Schedule 40 PVC Conduit Pipe and Schedule 80 PVC Conduit
The Differences between Schedule 40 PVC Conduit Pipe and Schedule 80 PVC ConduitThe Differences between Schedule 40 PVC Conduit Pipe and Schedule 80 PVC Conduit
The Differences between Schedule 40 PVC Conduit Pipe and Schedule 80 PVC Conduit
Guangdong Ctube Industry Co., Ltd.
 
Mahipalpur Call Girls Delhi 🔥 9711199012 ❄- Pick Your Dream Call Girls with 1...
Mahipalpur Call Girls Delhi 🔥 9711199012 ❄- Pick Your Dream Call Girls with 1...Mahipalpur Call Girls Delhi 🔥 9711199012 ❄- Pick Your Dream Call Girls with 1...
Mahipalpur Call Girls Delhi 🔥 9711199012 ❄- Pick Your Dream Call Girls with 1...
simrangupta87541
 
Cricket management system ptoject report.pdf
Cricket management system ptoject report.pdfCricket management system ptoject report.pdf
Cricket management system ptoject report.pdf
Kamal Acharya
 
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdfSELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
Pallavi Sharma
 
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASICINTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
GOKULKANNANMMECLECTC
 
Microsoft Azure AD architecture and features
Microsoft Azure AD architecture and featuresMicrosoft Azure AD architecture and features
Microsoft Azure AD architecture and features
ssuser381403
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
felixwold
 
Online train ticket booking system project.pdf
Online train ticket booking system project.pdfOnline train ticket booking system project.pdf
Online train ticket booking system project.pdf
Kamal Acharya
 
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl LucknowCall Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
yogita singh$A17
 
Sri Guru Hargobind Ji - Bandi Chor Guru.pdf
Sri Guru Hargobind Ji - Bandi Chor Guru.pdfSri Guru Hargobind Ji - Bandi Chor Guru.pdf
Sri Guru Hargobind Ji - Bandi Chor Guru.pdf
Balvir Singh
 
Technological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdfTechnological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdf
tanujaharish2
 
Cuttack Call Girls 💯Call Us 🔝 7374876321 🔝 💃 Independent Female Escort Service
Cuttack Call Girls 💯Call Us 🔝 7374876321 🔝 💃 Independent Female Escort ServiceCuttack Call Girls 💯Call Us 🔝 7374876321 🔝 💃 Independent Female Escort Service
Cuttack Call Girls 💯Call Us 🔝 7374876321 🔝 💃 Independent Female Escort Service
yakranividhrini
 
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
nainakaoornoida
 
Better Builder Magazine, Issue 49 / Spring 2024
Better Builder Magazine, Issue 49 / Spring 2024Better Builder Magazine, Issue 49 / Spring 2024
Better Builder Magazine, Issue 49 / Spring 2024
Better Builder Magazine
 
🔥 Hyderabad Call Girls  👉 9352988975 👫 High Profile Call Girls Whatsapp Numbe...
🔥 Hyderabad Call Girls  👉 9352988975 👫 High Profile Call Girls Whatsapp Numbe...🔥 Hyderabad Call Girls  👉 9352988975 👫 High Profile Call Girls Whatsapp Numbe...
🔥 Hyderabad Call Girls  👉 9352988975 👫 High Profile Call Girls Whatsapp Numbe...
aarusi sexy model
 
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
IJCNCJournal
 
🔥Independent Call Girls In Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Esco...
🔥Independent Call Girls In Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Esco...🔥Independent Call Girls In Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Esco...
🔥Independent Call Girls In Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Esco...
AK47
 

Recently uploaded (20)

Data Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdfData Communication and Computer Networks Management System Project Report.pdf
Data Communication and Computer Networks Management System Project Report.pdf
 
College Call Girls Kolkata 🔥 7014168258 🔥 Real Fun With Sexual Girl Available...
College Call Girls Kolkata 🔥 7014168258 🔥 Real Fun With Sexual Girl Available...College Call Girls Kolkata 🔥 7014168258 🔥 Real Fun With Sexual Girl Available...
College Call Girls Kolkata 🔥 7014168258 🔥 Real Fun With Sexual Girl Available...
 
CSP_Study - Notes (Paul McNeill) 2017.pdf
CSP_Study - Notes (Paul McNeill) 2017.pdfCSP_Study - Notes (Paul McNeill) 2017.pdf
CSP_Study - Notes (Paul McNeill) 2017.pdf
 
The Differences between Schedule 40 PVC Conduit Pipe and Schedule 80 PVC Conduit
The Differences between Schedule 40 PVC Conduit Pipe and Schedule 80 PVC ConduitThe Differences between Schedule 40 PVC Conduit Pipe and Schedule 80 PVC Conduit
The Differences between Schedule 40 PVC Conduit Pipe and Schedule 80 PVC Conduit
 
Mahipalpur Call Girls Delhi 🔥 9711199012 ❄- Pick Your Dream Call Girls with 1...
Mahipalpur Call Girls Delhi 🔥 9711199012 ❄- Pick Your Dream Call Girls with 1...Mahipalpur Call Girls Delhi 🔥 9711199012 ❄- Pick Your Dream Call Girls with 1...
Mahipalpur Call Girls Delhi 🔥 9711199012 ❄- Pick Your Dream Call Girls with 1...
 
Cricket management system ptoject report.pdf
Cricket management system ptoject report.pdfCricket management system ptoject report.pdf
Cricket management system ptoject report.pdf
 
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdfSELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
 
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASICINTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
INTRODUCTION TO ARTIFICIAL INTELLIGENCE BASIC
 
Microsoft Azure AD architecture and features
Microsoft Azure AD architecture and featuresMicrosoft Azure AD architecture and features
Microsoft Azure AD architecture and features
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
 
Online train ticket booking system project.pdf
Online train ticket booking system project.pdfOnline train ticket booking system project.pdf
Online train ticket booking system project.pdf
 
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl LucknowCall Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
Call Girls In Lucknow 🔥 +91-7014168258🔥High Profile Call Girl Lucknow
 
Sri Guru Hargobind Ji - Bandi Chor Guru.pdf
Sri Guru Hargobind Ji - Bandi Chor Guru.pdfSri Guru Hargobind Ji - Bandi Chor Guru.pdf
Sri Guru Hargobind Ji - Bandi Chor Guru.pdf
 
Technological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdfTechnological Innovation Management And Entrepreneurship-1.pdf
Technological Innovation Management And Entrepreneurship-1.pdf
 
Cuttack Call Girls 💯Call Us 🔝 7374876321 🔝 💃 Independent Female Escort Service
Cuttack Call Girls 💯Call Us 🔝 7374876321 🔝 💃 Independent Female Escort ServiceCuttack Call Girls 💯Call Us 🔝 7374876321 🔝 💃 Independent Female Escort Service
Cuttack Call Girls 💯Call Us 🔝 7374876321 🔝 💃 Independent Female Escort Service
 
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
❣Independent Call Girls Chennai 💯Call Us 🔝 7737669865 🔝💃Independent Chennai E...
 
Better Builder Magazine, Issue 49 / Spring 2024
Better Builder Magazine, Issue 49 / Spring 2024Better Builder Magazine, Issue 49 / Spring 2024
Better Builder Magazine, Issue 49 / Spring 2024
 
🔥 Hyderabad Call Girls  👉 9352988975 👫 High Profile Call Girls Whatsapp Numbe...
🔥 Hyderabad Call Girls  👉 9352988975 👫 High Profile Call Girls Whatsapp Numbe...🔥 Hyderabad Call Girls  👉 9352988975 👫 High Profile Call Girls Whatsapp Numbe...
🔥 Hyderabad Call Girls  👉 9352988975 👫 High Profile Call Girls Whatsapp Numbe...
 
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
Particle Swarm Optimization–Long Short-Term Memory based Channel Estimation w...
 
🔥Independent Call Girls In Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Esco...
🔥Independent Call Girls In Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Esco...🔥Independent Call Girls In Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Esco...
🔥Independent Call Girls In Pune 💯Call Us 🔝 7014168258 🔝💃Independent Pune Esco...
 

Polygons - Computer Graphics - Notes

  • 1. Polygon (Definition) 1 Polygon is a figure having many slides. It may be represented as a number of line segments end to end to form a closed figure. The line segments which form the boundary of polygon are called as edges or slides of polygon. The end of the side are called the polygon vertices. Triangle is the most simple form of polygon having three side and three vertices. The polygon may be of any shape.
  • 2. Types of Polygon 2 1. Convex 2. Concave 3. Complex
  • 3. Convex 3 Convex polygon is a polygon in which if we take any points which are surely inside the polygon and if we draw a joining these two points and if all the points on that line lies into the polygon, then such a polygon is called as convex polygon.
  • 4. Concave 4 Concave polygon is a polygon in which if we take any two points which are surely inside the polygon and if we draw a line joining these two points and if all the points on that line are not lying inside the polygon, then such a polygon is called as concave polygon.
  • 5. Complex 5 In a computer graphics, a polygon which is neither convex nor concave is referred as complex polygons. The complex polygon includes any polygon which intersects itself of the polygon which overlaps itself. The complex polygon has a boundary.
  • 6. Polygon Representation 6 OP X Y 6 5 5 2 7 5 2 9 3 2 7 1 2 5 1 2 3 3 2 5 5 A(5,5) F(3,3) E(5,1) D(7,1) B(7,5) C(9,3)
  • 7. Inside Test Methods 7 1. Even-odd Method 2. Winding Number Method
  • 8. Even - Odd Methods 8 x4,y4 x3,y3 x2,y2 x1,y1 Count even Outside Point ‘B’ A Fig. 3.2.2 Fig. 3.2.3 Fig. 3.2.4 Outside Point ‘B’ AC Count Odd Fig. 3.2.5 ACB A B C D A
  • 9. Winding Number Methods 9 1 -1 1 Fig. 3.2.7 Fig. 3.2.8 Fig. 3.2.9 AB C 1 Newly drawn line +1 -1 DC B A
  • 10. Winding Number Methods 10 Fig. 3.2.10 (c) Fig. 3.2.10 (a) Fig. 3.2.10 (b) -1 -1+1 D AB C Case I Case II Case III B C A D -1 -1+1 B C D A -1-1 +1
  • 11. Polygon Filling 11 Polygon Filling Algorithm 1. Boundary Fill Algorithm 2. Flood Fill (Seed Fill) Algorithm 3. Edge Fill Algorithm 4. Fence Fill Algorithm 1. Scan Line Algorithm Pixel Level Geometric Level
  • 12. 4-connected Method 12 In this 4 neighboring points of a current test point are tested. These are pixel positions that are right, left, above and below of current pixels as shown in figure 2.26 8-connected Method Here 8 neighboring pixels of current test pixel are tested. These pixel positions are left, right, above and 4 – diagonal positions of current pixel as shown in figure 2.27
  • 13. Boundary Fill Algorithm 13 bfill (x, y, newcolor) { current = getpixel (x, y); if (current != newcolor)) && (current != boundarycolor) { putpixel (x, y, newcolor); bfill (x+1, y, newcolor); bfill (x-1, y, newcolor); bfill (x, y+1, newcolor); bfill (x, y-1, newcolor); } } The following procedure illustrate a recursive method for boundary fill by using 4-connected method.
  • 14. Flood Fill (Seed fill) Algorithm 14 F-fill (x, y, newcolor) { current = getpixel (x, y); if (current != newcolor) { putpixel (x, y, newcolor); f-fill (x-1, y, newcolor); f-fill (x+1, y, newcolor); f-fill (x, y-1, newcolor); f-fill (x, y+1, newcolor); } } The following procedure illustrate a recursive method for flood fill by using 4-connected method.
  • 15. Scan line Algorithm 15 (0,0) y min y max A(x1, y1) B(x2,y2) C(x3, y3) D(x4, y4) Fig. 3.4.1 Edge y max x max y min x min Slope AB y2 x2 y1 x1 m1 AD y4 x4 y1 x1 m2 CD y3 x4 Y4 x4 m3 BC y2 x2 y3 x3 m4 Fig. 3.4.1
  • 16. Scan line Algorithm 16 Edge y max x max y min x min Slope AB y2 x2 y1 x1 m1 BC y2 x2 y3 x3 m4 CD y3 x3 Y4 x4 m3 AD y4 x4 y1 x1 m2 Fig. 3.4.2 y max =y2 y2-2 y2-2 y min A(x1,y1) B(x2, y2)
  • 17. Scan line Algorithm 17 Fig. 3.4.3 Fig. 3.4.4 Edge y max x max y min x min Slope AB y1 x1 y2 x2 m1 BC y1 x1 y5 x3 m2 CD y3 x3 Y2 x2 m3 AD y x y x m4 A(x1,y1) D(x4,y4) C(x3,y3) B(x2,y2) max min A (x1,y1) C (x3,y3) D(x4,y4) B (x2,y2) E (x5,y5) Y max Y min
  • 18. Scan line Algorithm 18 Fig. 3.4.5 Fig. 3.4.6 A C D B E P2 P3 P4P1 yp P3 P2P1
  • 19. Flood fill Vs Boundary fill Vs Edge fill Vs Fence fill Vs Scan line fill 19 Flood fill Boundary Fill Edge fill Fence Fill Scan line fill Need Seed point to start. Need Seed point to start. Based on complimenting the pixels. Based on complimenting the pixels. Based on line drawing, polygon is filled. Current pixels color is compared with new pixel color. Current pixels color is compared with new pixel color and boundary color. Pixels which are on right side of an edge are getting complemented. Pixels which are on right side of an edge and to the left of fence as well as left side of edge and right side of fence are getting complemented. Intersection of polygon edges are found with the scan line and then the solid lines are drawn between two such intersection points. Useful for polygons having single color boundary. Useful for polygons having multi color boundary. More number of pixels are unnecessarily accessed. Less number of pixels are accessed as compared to edge fill. Need separate attention to handle concave polygons.
  • 20. Connected boundary fill Algorithm boundary_fill (x, y, f_colour, b_colour) { if (getpixel (x, y) != b_colour && getpixel (x, y) != f_colour) { putpixel (x, y, f_colour); boundary_fill (x+1, y, f_colour, b_colour); boundary_fill (x-1, y, f_colour, b_colour); boundary_fill (x, y+1, f_colour, b_colour); boundary_fill (x, y-1, f_colour, b_colour); boundary_fill (x+1, y+1, f_colour, b_colour); boundary_fill (x-1, y-1, f_colour, b_colour); boundary_fill (x+1, y-1, f_colour, b_colour); boundary_fill (x-1, y+1, f_colour, b_colour); } } To enhance speed of filling colour one may look for alternative of 4-connected. In this algorithm all adjacent pixels will be consider for filling till the match is true. Algorithm is as follows : 20
  翻译: