0 Members and 1 Guest are viewing this topic.
inputs pt1,pt2,pt3,color // color is unused for now// we sorts the points with the smallest Y firstif (pt1.y > pt2.y) swap(pt1,pt2) // swaps pt1.x with pt2.x and pt1.y with pt2.yIf (pt2.y > pt3.y) swap(pt2,pt3)If(pt1.y > pt3.y) swap(pt1,pt3)dx1 = (x2-x1)/(y2-y1)dx2 = (x3-x1)/(y3-y1)slx2 = slx1 = x1sly = y1drawLoop:While (sly < y2){ HorizontalLine(sly, slx1, slx2) slx1 = slx1 + dx1 slx2 = slx2 + dx2 sly++}If (y2 != y3){ dx1 = (x3-x2)/(y3-y2) y2 = y3 goto drawLoop}