Well, not haywire, but at some points it will just draw two dots instead of the entire triangle. I was hoping you guys would be able to figure it out.

DEFINT A-Z

'$DYNAMIC

DECLARE SUB Triangle2 (x1%, y1%, x2%, y2%, x3%, y3%, c%)

DIM SHARED buffer(32001), lutsegy(199) AS LONG

CONST PI180 = 3.141592654# / 180

buffer(0) = 2560: buffer(1) = 200

FOR n& = 0 TO 199

lutsegy(n&) = n& * 320 + 4

NEXT

SCREEN 13

DEF SEG = VARSEG(buffer(0))

x1 = 11: y1 = 1

x2 = 1: y2 = 21

x3 = 21: y3 = 21

xc = 149

yc = 89

t# = TIMER

DO

Triangle2 x1, y1, x2, y2, x3, y3, 4

ang = ang + 3: IF ang > 359 THEN ang = ang - 360

x1 = (COS(ang * PI180) * 30) + 189

y1 = (SIN(ang * PI180) * 30) + 149

x2 = (COS((ang + 120) * PI180) * 30) + 189

y2 = (SIN((ang + 120) * PI180) * 30) + 149

x3 = (COS((ang + 240) * PI180) * 30) + 189

y3 = (SIN((ang + 240) * PI180) * 30) + 149

PUT (0, 0), buffer, PSET

REDIM buffer(32001)

buffer(0) = 2560: buffer(1) = 200

fr = fr + 1

FOR g = 0 TO 500: WAIT &H3DA, 8: NEXT

LOOP UNTIL LEN(INKEY$)

PRINT fr / (TIMER - t#)

SUB Triangle2 (x1%, y1%, x2%, y2%, x3%, y3%, c%)

DIM addr AS LONG

'This one uses some tricks with integer math to avoid

'any floating point math

IF y1% > y2% THEN SWAP y1%, y2%: SWAP x1%, x2%

IF y1% > y3% THEN SWAP y1%, y3%: SWAP x1%, x3%

IF y2% > y3% THEN SWAP y2%, y3%: SWAP x2%, x3%

DeltaY1% = y2% - y1%

DeltaY2% = y3% - y2%

DeltaY3% = y3% - y1%

IF DeltaY1% THEN d1& = (x2% - x1%) * &H10000 \ DeltaY1%

IF DeltaY2% THEN d2& = (x3% - x2%) * &H10000 \ DeltaY2%

IF DeltaY3% THEN d3& = (x3% - x1%) * &H10000 \ DeltaY3%

lx& = x1% * &H10000

rx& = lx&

addr = lutsegy(y1%)

FOR y% = y1% TO y2% - 1 'Draw from high point to mid point

lx% = lx& \ &H10000

rx% = rx& \ &H10000

FOR l = lx% TO rx%

POKE addr + l, c%

NEXT

lx& = lx& + d1&

rx& = rx& + d3&

addr = addr + 320

NEXT

lx& = x2% * &H10000

addr = lutsegy(y2%)

FOR y% = y2% TO y3% 'Draw from mid point to low point

lx% = lx& \ &H10000

rx% = rx& \ &H10000

FOR l = lx% TO rx%

POKE addr + l, c%

NEXT

lx& = lx& + d2&

rx& = rx& + d3&

addr = addr + 320

NEXT

END SUB