Post by tenochtitlanuk on Jan 28, 2023 16:01:16 GMT -5
Seeing some graphics on JB Forum and a follow-up to earlier LB at graphics curio I disinterred my Lissajous code and added HSV colouring so you can see a set of 16 being drawn. I played with various versions- some using EOR pixel drawing- but this one I was most pleased with.


nomainwin
WindowWidth = 720
WindowHeight = 780
graphicbox #w.g 12, 2, 680, 680
open "Lissajous" for window as #w
#w "trapclose quit"
#w.g "down ; fill darkblue"
#w.g "color white ; size 2 ; flush"
global col$
radius =36
dim SI( 3600), CO( 3600)
for t =0 to 359
SI( t) =S( t) ' look-up array for sin ( of t in degrees)
CO( t) =C( t)
next t
for ny =1 to 8
for nx =1 to 8
for theta =0 to 359 step 0.4
xS =int( nx *80 +radius *SI( ( nx *theta) mod 360) -20)
yS =int( ny *80 +radius *CO( ( ny *theta) mod 360) -20)
#w.g "set "; xS; " "; yS
scan
next theta
next nx
next ny
#w.g "flush"
#w.g "size 2"
'#w.g "rule "; _R2_XORPEN
'#w.g "color white"
[here]
for theta =0 to 359 step 0.4
for nx =1 to 8
for ny =1 to 8
'xS =int( nx *80 +radius *S( nx *theta) -20)
xS =int( nx *80 +radius *SI( ( nx *theta) mod 360) -20)
'yS =int( ny *80 +radius *C( ny *theta) -20)
yS =int( ny *80 +radius *CO( ( ny *theta) mod 360) -20)
call hsv2rgb theta, 0.99, 0.99
#w.g "color "; col$
#w.g "set "; xS; " "; yS
next ny
scan
next nx
next theta
#w.g "getbmp scr 1 1 680 680"
#w.g "cls"
#w.g "drawbmp scr 1 1"
'bmpsave "scr", "lissajous" +right$( "000" +str$( h), 3) +".bmp"
goto [here]
wait ' _________________________________________________________
function S( t)
t =( t +360) mod 360
S =sin( t *3.14159265 /180)
end function
function C( t)
t =( t +360) mod 360
C =cos( t *3.14159265 /180)
end function
sub hsv2rgb h, s, v ' hue 0-360, saturation 0-1, value 0-1
if h >=360 or s >1 or v >1 then wait
c =v *s ' chroma
h =h
x =c *( 1 -abs( ( ( h /60) mod 2) -1))
m =v -c ' matching adjustment
select case
case h < 60
r = c: g = x: b = 0
case h <120
r = x: g = c: b = 0
case h <180
r = 0: g = c: b = x
case h <240
r = 0: g = x: b = c
case h <300
r = x: g = 0: b = c
case else
r = c: g = 0: b = x
end select
rd = abs( int( 256 *( r + m)))
gn = abs( int( 256 *( g + m)))
bu = abs( int( 256 *( b + m)))
col$ =right$( " " +str$( rd), 3) +" " +right$( " " +str$( gn), 3) +" " +right$( " " +str$( bu), 3)
end sub
sub quit h$
close #w
end
end sub