Post by tsh73 on May 23, 2018 21:25:43 GMT
It started as attempt to create warped weave.
So I got mesh warped OK... didn't got weave right.
Got this instead.
So I got mesh warped OK... didn't got weave right.
Got this instead.
'spinoff of rotated weave
'tsh73 may 2018
nomainwin
open "Errr... Windows?" for graphics_nsb_nf as #gr
#gr "trapclose [quit]"
#gr "down"
#gr "fill white; flush"
#gr "home; posxy cx cy"
'#gr "home; circle 50"
side= 20
pi = acs(-1)
#gr "size 3"
scale1 =.85
scale2 =.7
for x = 0 to 2*cx step side
for y = 0 to 2*cy step side
xx=x'+side*sin(x/cx*pi)
xx=side+(x+side*sin(y/cy*pi))*scale1
yy=side+(y+side*sin(0-x/cx*pi))*scale1
aDeg=atan2(side*(sin(0-x/cx*pi)-sin(0-(x-side)/cx*pi)),side)/pi*180
col=2*int(sin(y/cy*pi)+1)+int(sin(x/cx*pi)+1)+1
#gr "color ";word$(" yellow blue green red", col)
call drawfilledrectangle aDeg, xx, yy, scale2*side, scale2*side
next
next
#gr "flush"
wait
[quit]
timer 0
close #gr
end
'-----by B+
sub drawfilledrectangle a, x, y, w, h 'tsh fixed
#gr "size 2;north;turn 180;turn ";a
for i = 1 to h 'draw *part of* bigger and bigger rectangles
#gr "place ";x;" ";y;";go ";i;";turn -90;go ";w;";turn 90"
next
#gr "size 1"
end sub
'---------------------------
function atan2(y,x)
pi = acs(-1) 'could be made global to save some ticks
if x <> 0 then arctan = atn(y/x)
select case
case x > 0
atan2 = arctan
case y>=0 and x<0
atan2 = pi + arctan
case y<0 and x<0
atan2 = arctan - pi
case y>0 and x=0
atan2 = pi / 2
case y<0 and x=0
atan2 = pi / -2
end select
end function