User Tools

Site Tools


base:lines

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
base:lines [2015-11-19 13:28]
bitbreaker [Run length slice]
base:lines [2016-07-19 12:51] (current)
bitbreaker [Bresenham]
Line 20: Line 20:
   * steep slope with decrementing y and decrementing on x   * steep slope with decrementing y and decrementing on x
  
-The versions for decrementing/​incrementing x only differ in the x handling, so after all we have two algorithms that we use, one specialized on steep slopes and one for teh flat slopes.+The versions for decrementing/​incrementing x only differ in the x handling, so after all we have two algorithms that we use, one specialized on steep slopes and one for the flat slopes.
  
-So for steep slopes we always take one y step per pixel, but when our error value overflows we take also a step in x direction. For that we use a mask to cover 8 x steps. So a stepping for e.g. one pixel to teh right is just a shift on the mask with lsr mask. The good thing is, when the pixel falls out on the right side, the carry will be set, and thus we know when we bump on the end of our column that we draw in, no matter if we draw on a hires screen or a 16x16 charset grid. In that case we have to do further steps, like adjusting the target where we write the pixels to, as well as resetting the mask to $80 in that case.+So for steep slopes we always take one y step per pixel, but when our error value overflows we take also a step in x direction. For that we use a mask to cover 8 x steps. So a stepping for e.g. one pixel to the right is just a shift on the mask with lsr mask. The good thing is, when the pixel falls out on the right side, the carry will be set, and thus we know when we bump on the end of our column that we draw in, no matter if we draw on a hires screen or a 16x16 charset grid. In that case we have to do further steps, like adjusting the target where we write the pixels to, as well as resetting the mask to $80 in that case.
  
 ===== Pixel collecting on flat slopes ===== ===== Pixel collecting on flat slopes =====
base/lines.txt ยท Last modified: 2016-07-19 12:51 by bitbreaker