IF is right major triangle (dir = 1)
1. load xright with xm
2. load xleft with xh
3. load xright_inc with dxmdy
4. load xleft_inc with dxhdy
5. load j with yh
6. if j is less than ym then, increment j by 1, increment xleft by xleft_inc, increment xright by xright_inc, render span (at vertical line j) from xleft to xright. repeat step 6 until j >= ym.
7. load xright with xl
8. load xright_inc with dxldy
9. load xleft_inc with dxhdy
10. load j with ym
11. if j is less than yl then, increment j by 1, increment xleft by xleft_inc, increment xright by xright_inc, render span (at vertical line j) from xleft to xright. repeat step 11 until j >= yl.
ELSE
1. load xright with xh
2. load xleft with xm
3. load xright_inc with dxhdy
4. load xleft_inc with dxmdy
5. load j with yh
6. if j is less than ym then, increment j by 1, increment xleft by xleft_inc, increment xright by xright_inc, render span (at vertical line j) from xleft to xright. repeat step 6 until j >= ym.
7. load xleft with xl
8. load xright_inc with dxhdy
9. load xleft_inc with dxldy
10. load j with ym
11. if j is less than yl then, increment j by 1, increment xleft by xleft_inc, increment xright by xright_inc, render span (at vertical line j) from xleft to xright. repeat step 11 until j >= yl.