Graphics / Playgrounds / Triangle rasteriser
Triangle rasteriser draft
Triangle rasteriser lets you set vertices A, B and C in the y-down coordinate system and choose whether the active edge swaps at B. Use Step, Back, Run and Reset to inspect each scanline's active edges, left and right intersections and filled span, including the failure that appears when the edge swap is disabled.
- A
- (2, 1)
- B
- (12, 3)
- C
- (6, 8)
- m_AB
- (xB - xA)/(yB - yA) = 5
- m_AC
- (xC - xA)/(yC - yA) = 0.571
- m_BC
- (xC - xB)/(yC - yB) = -1.2
- y = 1: x_AB = x_AB + m_AB = 2; x_AC = x_AC + m_AC = 2; fill x from 2 to 2: 0 pixel(s)
- y = 2: x_AB = x_AB + m_AB = 7; x_AC = x_AC + m_AC = 2.571; fill x from 2.571 to 7: 4 pixel(s)
- y = 3: x_BC = x_BC + m_BC = 12; x_AC = x_AC + m_AC = 3.143; fill x from 3.143 to 12: 8 pixel(s)
- y = 4: x_BC = x_BC + m_BC = 10.8; x_AC = x_AC + m_AC = 3.714; fill x from 3.714 to 10.8: 7 pixel(s)
- y = 5: x_BC = x_BC + m_BC = 9.6; x_AC = x_AC + m_AC = 4.286; fill x from 4.286 to 9.6: 5 pixel(s)
- y = 6: x_BC = x_BC + m_BC = 8.4; x_AC = x_AC + m_AC = 4.857; fill x from 4.857 to 8.4: 4 pixel(s)
- y = 7: x_BC = x_BC + m_BC = 7.2; x_AC = x_AC + m_AC = 5.429; fill x from 5.429 to 7.2: 2 pixel(s)
- y = 8: x_BC = x_BC + m_BC = 6; x_AC = x_AC + m_AC = 6; fill x from 6 to 6: 0 pixel(s)
0 / 8