Rasterising Exercises#

Exercise 26

Writing out each stage of the algorithm, use the modified Bresenham's algorithm to draw the lines joining points with the following co-ordinates:

(a) \((2,2)\) and \((7,5)\)

(b) \((8,3)\) and \((5,8)\)

Exercise 27

Writing out each stage of the algorithm, use the midpoint algorithm to calculate the positions of pixels on the first octant of a circle centred at \((11,11)\) with radius 9.

Exercise 28

The edges of a triangular polygon with vertices at the pixel co-ordinates \((6, 2)\), \((2, 6)\) and \((9, 9)\) have been rasterised resulting in the raster shown below. Using the starting pixel \((5,5)\), use the flood fill algorithm to fill the interior of the polygon where the target colour is white and the replacement colour is blue. Write out the queue at each step of the algorithm.

../_images/exercise_28.png

Exercise 29

Use the scanline algorithm to rasterise the triangular polygon from Exercise 28.

../_images/exercise_29.png