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

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

View Full Document Right Arrow Icon
Region Filling Computer Graphics Lecture 6
Background image of page 1

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

View Full DocumentRight Arrow Icon
Contents Problem description Flood fill Scan Conversion Optimized Scan Conversion Summary
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
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.
Background image of page 5

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

View Full DocumentRight Arrow Icon
Flood fill algorithm (cont)
Background image of page 6
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
Background image of page 7

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

View Full DocumentRight Arrow Icon
Flood fill algorithm (cont)
Background image of page 8
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. Note: to obtain an accurate edge count, we
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/14/2011 for the course CS 61118 taught by Professor Alexfrid during the Fall '11 term at Technion.

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 Right Arrow Icon
Ask a homework question - tutors are online