SlideShare a Scribd company logo
Polygon  surfaces A polygon is an important  graphics primitive.  A polygon is a  closed area  of image bounded by straight or curved lines and filled with one solid color.  Since images are two dimensional, a polygon is a closed planar figure.
Polygon  surfaces A polygon can be defined as an image which consists of a finite ordered set of straight boundaries called  edges .  The polygon can also be defined by an ordered sequence of  vertices , i.e, the corners of the polygon.  The edges of the polygon are then obtained by traversing the vertices in the given order;  Two consecutive vertices define one edge.  The polygon can be closed  by connecting the last vertex to the first.  Face list or polygon surface table is required in order to fill the polygon.
 
Area Filling Algorithms Scan line polygon fill algorithm Boundary fill algorithm Flood fill algorithm
Scan-Line Polygon Fill Algorithm Odd-parity rule Calculate span intersections on each scan line using parity rule to determine whether or not a point is inside a region  Parity is initially even     each intersection encountered thus inverts the parity bit  parity is odd     interior point (draw) parity is even    exterior point (do not draw) o o e e o e/o e
Scan-Line Polygon Fill Algorithm Case 1 Check the endpoint y values of two intersected edges    if their change is monotonically, we should count the intersection only once    Otherwise, we should count the intersection twice. Case 2   At the shared vertex: shorten the lower edge one grid below the shared point, such that the two edges are disconnected;    Alternative way:  we only count the y[min] vertex of an edge but not the y[max] vertex for the adjacent edge. For horizontal line    do not count their vertices o o e e o e/o e Case 1: Case 2:
Scan-Line Polygon Fill Algorithm Finding intersection pairs : Scan-line conversion method (for non-horizontal edges):    Edge  coherence  property:  Incremental calculation between successive scan lines    Or using Bresenham’s scan line conversion algorithm on each edge and keep a table of span extrema for each scan line
Scan-Line Polygon Fill Algorithm Incremental scan line method : m = (y[k+1] – y[k])  /  (x[k+1] – x[k]) y[k+1] – y[k] = 1 x[k+1] = x[k] + 1/m    x[k] = x[0] + k/m Scan line y[k] + 1 Scan line y[k] (x[k+1],  y[k+1])  (x[k],  y[k])
Scan-Line Polygon Fill Algorithm Incremental scan line method : Bucket sorted edge table: containing all edges sorted by their smaller y coordinate.  Each bucket: edges are recorded in order of increasing x coordinate of the  lower endpoint. Each entry of a bucket:  y[max] of the edge, x[min] of lower endpoint and 1/m  (x increment) Active-edge table (or list): keep track of the set of edges that the scan line intersects  and the intersection points in a data structure
Scan-Line Polygon Fill Algorithm Example: 5 1 4 3 2 y5 x1 1/m[1,5] y2 x1 1/m[1,2] y5 x4 1/m[4,5] y3 x4 1/m[4,3] y3 x2 1/m[2,3] y4 : : y1 y2 : : : : 0 Sorted edge table (ET)
Scan-Line Polygon  Fill Algorithm Example: 5 1 4 3 2 y5 xa 1/m[1,5] y2 xb 1/m[1,2] y5 x5 1/m[1,5] y5 x5 1/m[4,5] y[5] : : y[a] : : : : : 0 Active edge table (AET) b a y3 xc 1/m[3,4] y2 xd 1/m[1,2] c d
Inside-outside tests  Odd-even rule (odd parity rule or even-odd rule) Counting the number of edge crossing along the line from point P to infinity Odd number    interior point P Even number    exterior point P Non-zero winding number rule (vector method)    winding number: no of times that the polygon edges wind around a point in the counterclockwise direction    if the winding number = 0    exterior point    if the winding number != 0     interior point
Boundary Fill Suppose that the edges of the polygon has already been colored. Suppose that the interior of the polygon is to be colored a different color from the edge. Suppose we start with a pixel inside the polygon, then we color that pixel and all surrounding pixels until we meet a pixel that is already colored.
void boundaryFill(int x, int y, int fillColor, int borderColor) { int interiorColor; getPixel(x,y,interiorColor); if ((interiorColor!=borderColor)&&(interiorColor!=fillColor)) { setPixel(x,y,fillColor); boundaryFill(x+1,y,fillColor,borderColor);  boundaryFill(x-1,y,fillColor,borderColor); boundaryFill(x,y+1,fillColor,borderColor); boundaryFill(x,y-1,fillColor,borderColor); } } Boundary Fill
Flood Fill Suppose we want to color the entire area whose original color is interiorColor, and replace it with fillColor. Then, we start with a point in this area, and then color all surrounding points until we see a pixel that is not interiorColor.
void floodFill(int x, int y, int fillColor, int interiorColor) { int color; getPixel(x,y,color) if (color==interiorColor) { setPixel(x,y,fillColor); floodFill(x+1,y,fillColor,interiorColor);  floodFill(x-1,y,fillColor,interiorColor); floodFill(x,y+1,fillColor,interiorColor); floodFill(x,y-1,fillColor,interiorColor); } } Flood Fill
Ad

More Related Content

What's hot (20)

L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logic
Manjula V
 
Predictive parser
Predictive parserPredictive parser
Predictive parser
Jothi Lakshmi
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
Ankit Katiyar
 
Adversarial search
Adversarial search Adversarial search
Adversarial search
Farah M. Altufaili
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
Rishabh Soni
 
Semantic nets in artificial intelligence
Semantic nets in artificial intelligenceSemantic nets in artificial intelligence
Semantic nets in artificial intelligence
harshita virwani
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Ehtisham Ali
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
Dr Sandeep Kumar Poonia
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler Design
Shine Raj
 
Randomized algorithms ver 1.0
Randomized algorithms ver 1.0Randomized algorithms ver 1.0
Randomized algorithms ver 1.0
Dr. C.V. Suresh Babu
 
Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphs
Ashikur Rahman
 
Single source Shortest path algorithm with example
Single source Shortest path algorithm with exampleSingle source Shortest path algorithm with example
Single source Shortest path algorithm with example
VINITACHAUHAN21
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
Kuppusamy P
 
Rabin karp string matcher
Rabin karp string matcherRabin karp string matcher
Rabin karp string matcher
Amit Kumar Rathi
 
Representing uncertainty in expert systems
Representing uncertainty in expert systemsRepresenting uncertainty in expert systems
Representing uncertainty in expert systems
bhupendra kumar
 
Chapter 5 Syntax Directed Translation
Chapter 5   Syntax Directed TranslationChapter 5   Syntax Directed Translation
Chapter 5 Syntax Directed Translation
Radhakrishnan Chinnusamy
 
A* Algorithm
A* AlgorithmA* Algorithm
A* Algorithm
Dr. C.V. Suresh Babu
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
Tech_MX
 
Divide and conquer - Quick sort
Divide and conquer - Quick sortDivide and conquer - Quick sort
Divide and conquer - Quick sort
Madhu Bala
 
Propositional And First-Order Logic
Propositional And First-Order LogicPropositional And First-Order Logic
Propositional And First-Order Logic
ankush_kumar
 
L03 ai - knowledge representation using logic
L03 ai - knowledge representation using logicL03 ai - knowledge representation using logic
L03 ai - knowledge representation using logic
Manjula V
 
Time and space complexity
Time and space complexityTime and space complexity
Time and space complexity
Ankit Katiyar
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
Rishabh Soni
 
Semantic nets in artificial intelligence
Semantic nets in artificial intelligenceSemantic nets in artificial intelligence
Semantic nets in artificial intelligence
harshita virwani
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Ehtisham Ali
 
Three address code In Compiler Design
Three address code In Compiler DesignThree address code In Compiler Design
Three address code In Compiler Design
Shine Raj
 
Graph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphsGraph Theory: Matrix representation of graphs
Graph Theory: Matrix representation of graphs
Ashikur Rahman
 
Single source Shortest path algorithm with example
Single source Shortest path algorithm with exampleSingle source Shortest path algorithm with example
Single source Shortest path algorithm with example
VINITACHAUHAN21
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
Kuppusamy P
 
Representing uncertainty in expert systems
Representing uncertainty in expert systemsRepresenting uncertainty in expert systems
Representing uncertainty in expert systems
bhupendra kumar
 
8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
Tech_MX
 
Divide and conquer - Quick sort
Divide and conquer - Quick sortDivide and conquer - Quick sort
Divide and conquer - Quick sort
Madhu Bala
 
Propositional And First-Order Logic
Propositional And First-Order LogicPropositional And First-Order Logic
Propositional And First-Order Logic
ankush_kumar
 

Viewers also liked (20)

Computer graphics
Computer graphicsComputer graphics
Computer graphics
Nanhen Verma
 
Polygon Fill
Polygon FillPolygon Fill
Polygon Fill
wahab13
 
Area filling algo
Area filling algoArea filling algo
Area filling algo
Prince Soni
 
Euler and hamilton paths
Euler and hamilton pathsEuler and hamilton paths
Euler and hamilton paths
University of Potsdam
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
Mohanlal Sukhadia University (MLSU)
 
Hamiltonian path
Hamiltonian pathHamiltonian path
Hamiltonian path
Arindam Ghosh
 
Backtracking
BacktrackingBacktracking
Backtracking
subhradeep mitra
 
Backtracking
BacktrackingBacktracking
Backtracking
Sulman Bin Khurshid
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithms
Kumar
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
Maruf Abdullah (Rion)
 
CAD - Unit-1 (Fundamentals of Computer Graphics)
CAD - Unit-1 (Fundamentals of Computer Graphics)CAD - Unit-1 (Fundamentals of Computer Graphics)
CAD - Unit-1 (Fundamentals of Computer Graphics)
Priscilla CPG
 
Clipping in Computer Graphics
Clipping in Computer Graphics Clipping in Computer Graphics
Clipping in Computer Graphics
Barani Tharan
 
Computer Graphics Programes
Computer Graphics ProgramesComputer Graphics Programes
Computer Graphics Programes
Abhishek Sharma
 
Lecture 2d point,curve,text,line clipping
Lecture   2d point,curve,text,line clippingLecture   2d point,curve,text,line clipping
Lecture 2d point,curve,text,line clipping
avelraj
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of ada
Sahil Kumar
 
Lecture applications of cg
Lecture   applications of cgLecture   applications of cg
Lecture applications of cg
avelraj
 
Clipping
ClippingClipping
Clipping
johanna20
 
Lecture+ +raster+&+random+scan+systems
Lecture+ +raster+&+random+scan+systemsLecture+ +raster+&+random+scan+systems
Lecture+ +raster+&+random+scan+systems
avelraj
 
Cohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmCohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithm
Shilpa Hait
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
Vikas Sharma
 
Polygon Fill
Polygon FillPolygon Fill
Polygon Fill
wahab13
 
Area filling algo
Area filling algoArea filling algo
Area filling algo
Prince Soni
 
Fill area algorithms
Fill area algorithmsFill area algorithms
Fill area algorithms
Kumar
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
Maruf Abdullah (Rion)
 
CAD - Unit-1 (Fundamentals of Computer Graphics)
CAD - Unit-1 (Fundamentals of Computer Graphics)CAD - Unit-1 (Fundamentals of Computer Graphics)
CAD - Unit-1 (Fundamentals of Computer Graphics)
Priscilla CPG
 
Clipping in Computer Graphics
Clipping in Computer Graphics Clipping in Computer Graphics
Clipping in Computer Graphics
Barani Tharan
 
Computer Graphics Programes
Computer Graphics ProgramesComputer Graphics Programes
Computer Graphics Programes
Abhishek Sharma
 
Lecture 2d point,curve,text,line clipping
Lecture   2d point,curve,text,line clippingLecture   2d point,curve,text,line clipping
Lecture 2d point,curve,text,line clipping
avelraj
 
backtracking algorithms of ada
backtracking algorithms of adabacktracking algorithms of ada
backtracking algorithms of ada
Sahil Kumar
 
Lecture applications of cg
Lecture   applications of cgLecture   applications of cg
Lecture applications of cg
avelraj
 
Lecture+ +raster+&+random+scan+systems
Lecture+ +raster+&+random+scan+systemsLecture+ +raster+&+random+scan+systems
Lecture+ +raster+&+random+scan+systems
avelraj
 
Cohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmCohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithm
Shilpa Hait
 
Ad

Similar to Lecture filling algorithms (20)

Polygon filling
Polygon fillingPolygon filling
Polygon filling
Ankit Garg
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
ShwetaShah754701
 
Boundary fill algm
Boundary fill algmBoundary fill algm
Boundary fill algm
rajeshranjithsingh
 
Computer graphics unit 4th
Computer graphics unit 4thComputer graphics unit 4th
Computer graphics unit 4th
TEJVEER SINGH
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
ShaishavShah8
 
Clipping
ClippingClipping
Clipping
AMIT VIRAMGAMI
 
Computer Graphics Pollygon filling Techniques.pdf
Computer Graphics Pollygon filling Techniques.pdfComputer Graphics Pollygon filling Techniques.pdf
Computer Graphics Pollygon filling Techniques.pdf
tabbu23
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
RYZEN14
 
Unit-5 BSR-1-02-2024 advanced algorithms .pptx
Unit-5 BSR-1-02-2024 advanced algorithms .pptxUnit-5 BSR-1-02-2024 advanced algorithms .pptx
Unit-5 BSR-1-02-2024 advanced algorithms .pptx
IronMan665214
 
Comparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementComparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for Improvement
IJMER
 
MATLABgraphPlotting.pptx
MATLABgraphPlotting.pptxMATLABgraphPlotting.pptx
MATLABgraphPlotting.pptx
PrabhakarSingh646829
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
Kuntal Bhowmick
 
Unit-2 PPT.ppt
Unit-2 PPT.pptUnit-2 PPT.ppt
Unit-2 PPT.ppt
GopalaKrishnanChandr7
 
clippiNG COMPUTER GRAPHICS A NEW ERA.pptx
clippiNG COMPUTER GRAPHICS A NEW ERA.pptxclippiNG COMPUTER GRAPHICS A NEW ERA.pptx
clippiNG COMPUTER GRAPHICS A NEW ERA.pptx
urvashipundir04
 
Bt9301, computer graphics
Bt9301, computer graphicsBt9301, computer graphics
Bt9301, computer graphics
smumbahelp
 
Module 3 polynomial functions
Module 3   polynomial functionsModule 3   polynomial functions
Module 3 polynomial functions
dionesioable
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
Balamurugan M
 
Fill area algorithm on computer graphics course
Fill area algorithm on computer graphics courseFill area algorithm on computer graphics course
Fill area algorithm on computer graphics course
zekudk
 
Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3
SIMONTHOMAS S
 
Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeks
Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeksBeginning direct3d gameprogrammingmath01_primer_20160324_jintaeks
Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeks
JinTaek Seo
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
Ankit Garg
 
Computer graphics unit 4th
Computer graphics unit 4thComputer graphics unit 4th
Computer graphics unit 4th
TEJVEER SINGH
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
ShaishavShah8
 
Computer Graphics Pollygon filling Techniques.pdf
Computer Graphics Pollygon filling Techniques.pdfComputer Graphics Pollygon filling Techniques.pdf
Computer Graphics Pollygon filling Techniques.pdf
tabbu23
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
RYZEN14
 
Unit-5 BSR-1-02-2024 advanced algorithms .pptx
Unit-5 BSR-1-02-2024 advanced algorithms .pptxUnit-5 BSR-1-02-2024 advanced algorithms .pptx
Unit-5 BSR-1-02-2024 advanced algorithms .pptx
IronMan665214
 
Comparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementComparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for Improvement
IJMER
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
Kuntal Bhowmick
 
clippiNG COMPUTER GRAPHICS A NEW ERA.pptx
clippiNG COMPUTER GRAPHICS A NEW ERA.pptxclippiNG COMPUTER GRAPHICS A NEW ERA.pptx
clippiNG COMPUTER GRAPHICS A NEW ERA.pptx
urvashipundir04
 
Bt9301, computer graphics
Bt9301, computer graphicsBt9301, computer graphics
Bt9301, computer graphics
smumbahelp
 
Module 3 polynomial functions
Module 3   polynomial functionsModule 3   polynomial functions
Module 3 polynomial functions
dionesioable
 
Fill area algorithm on computer graphics course
Fill area algorithm on computer graphics courseFill area algorithm on computer graphics course
Fill area algorithm on computer graphics course
zekudk
 
Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3Cs8092 computer graphics and multimedia unit 3
Cs8092 computer graphics and multimedia unit 3
SIMONTHOMAS S
 
Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeks
Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeksBeginning direct3d gameprogrammingmath01_primer_20160324_jintaeks
Beginning direct3d gameprogrammingmath01_primer_20160324_jintaeks
JinTaek Seo
 
Ad

Recently uploaded (20)

GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Agentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community MeetupAgentic Automation - Delhi UiPath Community Meetup
Agentic Automation - Delhi UiPath Community Meetup
Manoj Batra (1600 + Connections)
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 
Build With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdfBuild With AI - In Person Session Slides.pdf
Build With AI - In Person Session Slides.pdf
Google Developer Group - Harare
 
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
GDG Cloud Southlake #42: Suresh Mathew: Autonomous Resource Optimization: How...
James Anderson
 
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptxSmart Investments Leveraging Agentic AI for Real Estate Success.pptx
Smart Investments Leveraging Agentic AI for Real Estate Success.pptx
Seasia Infotech
 
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptxTop 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
Top 5 Benefits of Using Molybdenum Rods in Industrial Applications.pptx
mkubeusa
 
AsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API DesignAsyncAPI v3 : Streamlining Event-Driven API Design
AsyncAPI v3 : Streamlining Event-Driven API Design
leonid54
 
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptxDevOpsDays SLC - Platform Engineers are Product Managers.pptx
DevOpsDays SLC - Platform Engineers are Product Managers.pptx
Justin Reock
 
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Crazy Incentives and How They Kill Security. How Do You Turn the Wheel?
Christian Folini
 
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Enterprise Integration Is Dead! Long Live AI-Driven Integration with Apache C...
Markus Eisele
 
Q1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor PresentationQ1 2025 Dropbox Earnings and Investor Presentation
Q1 2025 Dropbox Earnings and Investor Presentation
Dropbox
 
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier VroomAI x Accessibility UXPA by Stew Smith and Olivier Vroom
AI x Accessibility UXPA by Stew Smith and Olivier Vroom
UXPA Boston
 
Artificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptxArtificial_Intelligence_in_Everyday_Life.pptx
Artificial_Intelligence_in_Everyday_Life.pptx
03ANMOLCHAURASIYA
 
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
The No-Code Way to Build a Marketing Team with One AI Agent (Download the n8n...
SOFTTECHHUB
 
How to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabberHow to Install & Activate ListGrabber - eGrabber
How to Install & Activate ListGrabber - eGrabber
eGrabber
 
Slack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teamsSlack like a pro: strategies for 10x engineering teams
Slack like a pro: strategies for 10x engineering teams
Nacho Cougil
 
fennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solutionfennec fox optimization algorithm for optimal solution
fennec fox optimization algorithm for optimal solution
shallal2
 
Bepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firmBepents tech services - a premier cybersecurity consulting firm
Bepents tech services - a premier cybersecurity consulting firm
Benard76
 
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Kit-Works Team Study_아직도 Dockefile.pdf_김성호
Wonjun Hwang
 
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
On-Device or Remote? On the Energy Efficiency of Fetching LLM-Generated Conte...
Ivano Malavolta
 
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025Zilliz Cloud Monthly Technical Review: May 2025
Zilliz Cloud Monthly Technical Review: May 2025
Zilliz
 

Lecture filling algorithms

  • 1. Polygon surfaces A polygon is an important graphics primitive. A polygon is a closed area of image bounded by straight or curved lines and filled with one solid color. Since images are two dimensional, a polygon is a closed planar figure.
  • 2. Polygon surfaces A polygon can be defined as an image which consists of a finite ordered set of straight boundaries called edges . The polygon can also be defined by an ordered sequence of vertices , i.e, the corners of the polygon. The edges of the polygon are then obtained by traversing the vertices in the given order; Two consecutive vertices define one edge. The polygon can be closed by connecting the last vertex to the first. Face list or polygon surface table is required in order to fill the polygon.
  • 3.  
  • 4. Area Filling Algorithms Scan line polygon fill algorithm Boundary fill algorithm Flood fill algorithm
  • 5. Scan-Line Polygon Fill Algorithm Odd-parity rule Calculate span intersections on each scan line using parity rule to determine whether or not a point is inside a region Parity is initially even  each intersection encountered thus inverts the parity bit parity is odd  interior point (draw) parity is even  exterior point (do not draw) o o e e o e/o e
  • 6. Scan-Line Polygon Fill Algorithm Case 1 Check the endpoint y values of two intersected edges  if their change is monotonically, we should count the intersection only once  Otherwise, we should count the intersection twice. Case 2 At the shared vertex: shorten the lower edge one grid below the shared point, such that the two edges are disconnected;  Alternative way: we only count the y[min] vertex of an edge but not the y[max] vertex for the adjacent edge. For horizontal line  do not count their vertices o o e e o e/o e Case 1: Case 2:
  • 7. Scan-Line Polygon Fill Algorithm Finding intersection pairs : Scan-line conversion method (for non-horizontal edges):  Edge coherence property: Incremental calculation between successive scan lines  Or using Bresenham’s scan line conversion algorithm on each edge and keep a table of span extrema for each scan line
  • 8. Scan-Line Polygon Fill Algorithm Incremental scan line method : m = (y[k+1] – y[k]) / (x[k+1] – x[k]) y[k+1] – y[k] = 1 x[k+1] = x[k] + 1/m  x[k] = x[0] + k/m Scan line y[k] + 1 Scan line y[k] (x[k+1], y[k+1]) (x[k], y[k])
  • 9. Scan-Line Polygon Fill Algorithm Incremental scan line method : Bucket sorted edge table: containing all edges sorted by their smaller y coordinate. Each bucket: edges are recorded in order of increasing x coordinate of the lower endpoint. Each entry of a bucket: y[max] of the edge, x[min] of lower endpoint and 1/m (x increment) Active-edge table (or list): keep track of the set of edges that the scan line intersects and the intersection points in a data structure
  • 10. Scan-Line Polygon Fill Algorithm Example: 5 1 4 3 2 y5 x1 1/m[1,5] y2 x1 1/m[1,2] y5 x4 1/m[4,5] y3 x4 1/m[4,3] y3 x2 1/m[2,3] y4 : : y1 y2 : : : : 0 Sorted edge table (ET)
  • 11. Scan-Line Polygon Fill Algorithm Example: 5 1 4 3 2 y5 xa 1/m[1,5] y2 xb 1/m[1,2] y5 x5 1/m[1,5] y5 x5 1/m[4,5] y[5] : : y[a] : : : : : 0 Active edge table (AET) b a y3 xc 1/m[3,4] y2 xd 1/m[1,2] c d
  • 12. Inside-outside tests Odd-even rule (odd parity rule or even-odd rule) Counting the number of edge crossing along the line from point P to infinity Odd number  interior point P Even number  exterior point P Non-zero winding number rule (vector method)  winding number: no of times that the polygon edges wind around a point in the counterclockwise direction  if the winding number = 0  exterior point  if the winding number != 0  interior point
  • 13. Boundary Fill Suppose that the edges of the polygon has already been colored. Suppose that the interior of the polygon is to be colored a different color from the edge. Suppose we start with a pixel inside the polygon, then we color that pixel and all surrounding pixels until we meet a pixel that is already colored.
  • 14. void boundaryFill(int x, int y, int fillColor, int borderColor) { int interiorColor; getPixel(x,y,interiorColor); if ((interiorColor!=borderColor)&&(interiorColor!=fillColor)) { setPixel(x,y,fillColor); boundaryFill(x+1,y,fillColor,borderColor); boundaryFill(x-1,y,fillColor,borderColor); boundaryFill(x,y+1,fillColor,borderColor); boundaryFill(x,y-1,fillColor,borderColor); } } Boundary Fill
  • 15. Flood Fill Suppose we want to color the entire area whose original color is interiorColor, and replace it with fillColor. Then, we start with a point in this area, and then color all surrounding points until we see a pixel that is not interiorColor.
  • 16. void floodFill(int x, int y, int fillColor, int interiorColor) { int color; getPixel(x,y,color) if (color==interiorColor) { setPixel(x,y,fillColor); floodFill(x+1,y,fillColor,interiorColor); floodFill(x-1,y,fillColor,interiorColor); floodFill(x,y+1,fillColor,interiorColor); floodFill(x,y-1,fillColor,interiorColor); } } Flood Fill
  翻译: