Graphics / Playgrounds / Line rasterisation
Line rasterisation draft
Line rasterisation lets you change the segment endpoints and choose the naïve, DDA, integer Bresenham or floating-endpoint Bresenham method. Use Step, Back, Run and Reset to follow the selected algorithm and inspect the state and operations carried at each pixel.
- m
- (y1 - y0)/(x1 - x0) = 0.444
- c
- y0 - m*x0 = 0.556
- x = 1: yi = m*x + c = 0.444*1 + 0.556 = 1; y = round(yi) = 1
- x = 2: yi = m*x + c = 0.444*2 + 0.556 = 1.444; y = round(yi) = 1
- x = 3: yi = m*x + c = 0.444*3 + 0.556 = 1.889; y = round(yi) = 2
- x = 4: yi = m*x + c = 0.444*4 + 0.556 = 2.333; y = round(yi) = 2
- x = 5: yi = m*x + c = 0.444*5 + 0.556 = 2.778; y = round(yi) = 3
- x = 6: yi = m*x + c = 0.444*6 + 0.556 = 3.222; y = round(yi) = 3
- x = 7: yi = m*x + c = 0.444*7 + 0.556 = 3.667; y = round(yi) = 4
- x = 8: yi = m*x + c = 0.444*8 + 0.556 = 4.111; y = round(yi) = 4
- x = 9: yi = m*x + c = 0.444*9 + 0.556 = 4.556; y = round(yi) = 5
- x = 10: yi = m*x + c = 0.444*10 + 0.556 = 5; y = round(yi) = 5
0 / 10