' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.12.16.16.28]) on 2024.01.14 at 01:23 (Coordinated Universal Time) ' QB64 program by vince ' https://qb64phoenix.com/forum/showthread.php?tid=270&pid=22598#pid22598 ' ported to BAM by Charlie Veniot declare sub tri(x1,y1, x2,y2, x3,y3, n) sw = 520 ' 1024 sh = 240 ' 480 dim m m = 20 screen _newimage(sw, sh+1, 32) do t = t + 0.02 m = 25+20*sin(t) cls tri (0, sh, sw/2, 0, sw, sh, 10) _display loop end sub tri(x1,y1, x2,y2, x3,y3, n) if n < 1 then exit sub cx = (x1 + x3)/2 cy = (y1 + y3)/2 a = _atan2(y3-y1, x3-x1) d = sqr((cy - y2)^2 + (cx - x2)^2) w = d*tan(sqr(n)/m) nx = 1*(w)*cos(a) ny = 1*(w)*sin(a) line (cx, cy)-step(nx, ny),_rgb(255,255,0) line -(x2, y2),_rgb(0,255,0) line (cx, cy)-step(-nx, -ny),_rgb(255,255,0) line -(x2, y2),_rgb(255,255,255) ' line (x1,y1)-(x3,y3),_rgb(255,255,0) tri (x1,y1, cx - nx, cy - ny, x2, y2, n - 1) tri (x3,y3, cx + nx, cy + ny, x2, y2, n - 1) end sub