{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# lec6 - Region Filling Computer Graphics Lecture 6 Contents...

This preview shows pages 1–10. Sign up to view the full content.

Region Filling Computer Graphics Lecture 6

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Contents Problem description Flood fill Scan Conversion Optimized Scan Conversion Summary
The Problem Given a closed two dimensional polygon, fill its interior with specified color on graphics display. Assumptions: Polygon is simple. i.e. no self intersections Polygon is simply connected

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Flood fill algorithm Also called boundary fill algorithm Let P be a polygon with n vertices v 0 to v n-1 (v n =v 0 ) Let C be the color to paint the polygon Let p=(x,y) Є P be a point inside P
Flood fill algorithm (cont) FloodFill(Polygon P, int x, int y, Color C) If not(OnBoundary(x,y,P) or Colored(x,y,C)) begin PlotPixel(x,y,C); FloodFill(P,x+1,y,C); FloodFill(P,x,y+1,C); FloodFill(P,x,y-1,C); FloodFill(P,x-1,y,C); end; Note: can be 8-neighbor filling also.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Flood fill algorithm (cont)
Flood fill algorithm (cont) What is the cost per pixel? What is the worst case stack size needed? Where is this algorithm used/useful? How do we get seed point? Inside/outside tests: odd-even rule

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Flood fill algorithm (cont)
Inside\Outside tests Odd even rule Draw a conceptual line from any position P to a distant point outside the coordinate extends of the object and count the number of edge crossings along the line.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 28

lec6 - Region Filling Computer Graphics Lecture 6 Contents...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online