answersLogoWhite

0


Best Answer

Scan conversion algorithm for polygon filling

1. read n, the number of vertices of polygon

2. read x and y coordinates of all vertices in array x[n] and y[n]

3. find ymin and ymax

4. Store the initial x value(x1) y values y1 and y2 for 2 end points and x increment from scan line to scan line for each edge in the array edges [n][4]. While doing this check that y1> y2, if not interchange y1 and y2 and corresponding x1 and x2 so that for each edge, y1 represents its maximum y coordinate and y2 represents its minimum y coordinate.

5. Sort the rows of array, edges [n][4] in descending of y1, descending order of y2 and ascending order of x2.

6. Set y=ymax

7. Find the active edges and update active edge list:

8. If(y > y2 and y <=y1)

9. { edge is active}

10. Else

11. { edge is not active}

12. Compute the x intersects for all active edges for current y value. Initially x intersect is x1 and x intersects for successive y values can be given as

13. where =and m=i.e slope of a line segment

14. If x intersect is vertex i.e x-intersect=x1 and y=y1 then apply vertex test to check whether to consider one intersect or 2 intersects. Store all x intersects in the x-intersects [ ] array.

15. Sort x-intersects [ ] array in the ascending order

16. Extract pairs of intersects from the sorted x-intersect [ ] array

17. Pass pairs of x values to line drawing routine to draw corresponding line segments

18. Set y=y-1

19. Repeat step 7 through 18 until y>=ymin

20. Stop

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the steps for flood fill algorithm for filling the polygon?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are steps of algorithm?

the number of steps of an algorithm will be countable and finite.


How algorithm is different from flowchart?

An algorithm is a series of steps leading to a result. A flowchart can be a graphical representation of the algorithm.


What is the rules that a calculator follows in performing a series of steps is called?

algorithm


Design step by steps algorithm on how to write the letter A and display the result?

Design step by steps algorithm on how to write the letter A and display the result


What is algorithm write properties of algorithm?

An ALGORITHM is a sequence of steps that depicts the program logic independent of the language in which it is to be implemented. An algorithm should be designed with space and time complexities in mind.


A sequence of steps leading to a desired end?

Algorithm


What is a set of procedures or steps for accomplishing a task?

algorithm


When given a list of numbers what are the steps to put them greatest to least?

There are several different algorithms for sorting numbers by size. ?The steps to take will depend on which algorithm you wish to use.There are several different algorithms for sorting numbers by size. ?The steps to take will depend on which algorithm you wish to use.There are several different algorithms for sorting numbers by size. ?The steps to take will depend on which algorithm you wish to use.There are several different algorithms for sorting numbers by size. ?The steps to take will depend on which algorithm you wish to use.


What are the set of steps used to solve a problem in C?

An Algorithm


What is algorithm and its use?

A set of steps for solving a particular problem


What is an algorithn?

If you mean "Algorithm" an algorithm is simply a set of rules, or steps to complete, which are needed to solve a particular problem. An example would be a recipe in a cookbook. A recipe is an algorithm.


What are the features of algorithm?

An algorithm is just a description of a series of steps used to solve a specific problem.