01-13-2024, 07:15 PM
new mod
Code: (Select All)
sw = 1024
sh = 480
dim shared 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
_limit 50
loop
sleep
system
sub tri(x1,y1, x2,y2, x3,y3, n)
if n < 1 then exit sub
'line (x1,y1)-(x2,y2)
'line -(x3,y3)
'line -(x1,y1)
cx = (x1 + x3)/2
cy = (y1 + y3)/2
'line (cx, cy) - (x2, y2), _rgb(255,0,0)
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(255,255,0)
line (cx, cy)-step(-nx, -ny),_rgb(255,255,0)
line -(x2, y2),_rgb(255,255,0)
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