11. Given that a simple graphics display has pixels coordinate (8,12) set to ON and that the computer converts coordinates to memory addresses using the formula:

location = (((Ysize - y)* Xsize) + x).Given that Xsize=20 columns and Ysize=15 rows, calculate the memory location for the above coordinate.4 mks

12.State three line drawing algorithms and explain what each algorithm is best suited to render.

1 answer

11. Substituting the given values into the formula:
location = (((15 - 12) * 20) + 8)
location = ((3 * 20) + 8)
location = (60 + 8)
location = 68

Therefore, the memory location for the coordinate (8,12) is 68.

12. Three line drawing algorithms are:

1. Digital Differential Analyzer (DDA) Algorithm: This algorithm calculates the incremental changes in x and y coordinates to draw a line. It is best suited for scenarios where the line has a small number of steps and the endpoints of the line are known.

2. Bresenham's Line Algorithm: This algorithm determines the closest pixels to the ideal line path using an efficient integer-based approach. It is best suited for scenarios where endpoints are known, and the line will be drawn on a raster graphics display or in printing.

3. Midpoint Line Algorithm: This algorithm uses a midpoint technique to determine the pixels closest to the actual line path. It is best suited for scenarios where rounding errors need to be minimized, and the line should be drawn on a raster graphics display or in printing.

Each of these algorithms has its advantages and disadvantages, and the choice of algorithm depends on the specific requirements of the application.