|
Post by tenochtitlanuk on Jan 28, 2023 16:23:13 GMT -5
For some reason the graphic isn't/wasn't showing... OK now.
|
|
|
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
|
|
|
Post by tenochtitlanuk on Jan 26, 2023 4:25:27 GMT -5
Great project- and some well-thought out extensions with the avatars.
Exactly the kind of project I too have found LB excels at- electro-mechanical tinkering, and easy production of graphic output!
|
|
|
Post by tenochtitlanuk on Jan 18, 2023 17:58:46 GMT -5
I think of this one as 'Heat Death of the Universe'- the Big Crunch.
|
|
|
Post by tenochtitlanuk on Jan 17, 2023 13:59:44 GMT -5
Pleased with this one. Again uses ImageMagick to create the GIF and display automatically in my web browser. Page on my website will follow. HSV colour palette works well on this one... EDIT link to web page and code.
|
|
|
Post by tenochtitlanuk on Jan 10, 2023 16:25:44 GMT -5
Been pressed for time recently but had fun on a graphic mentioned before Christmas. Using Linux/Wine/LB4.5 can be temperamental, but I can use LB to create a series of images, stitch them into an animated GIF referenced on an html webpage and open in web browser. Now to try other ideas- eg colours that vary radially, motion as in the example but biggest displacement in the centre, pulsing in and out. Will put a page on my LB site when I've time.. Hope you don't end with eye-strain- and Happy New Year anyway..
|
|
|
Post by tenochtitlanuk on Dec 22, 2022 10:44:19 GMT -5
Left my LB running Life for an hour or two and look what popped up! Season's Greetings to all the community- and Carl particularly!
|
|
|
Post by tenochtitlanuk on Dec 21, 2022 18:18:46 GMT -5
Thanks for your recent contributions, Meerkat. I keep intending to get into real database stuff, and enjoyed playing with RunBasic when it first came out, and you've provided a lot for me to get my teeth into if I have time. Keep it coming- and Happy Christmas.
|
|
|
Post by tenochtitlanuk on Dec 17, 2022 4:21:35 GMT -5
I was first fascinated by 'Life' when JH Conway introduced it to readers of Scientific American half a century and more ago! Sounds an interesting approach. Mind you my first coded attempts on early 8-bit machines were desperately slow compared with modern machines.
For fun I set my old Life going last night on a 600x600 grid late last night, and it generated 200 images which I made into an animated GIF. My interest in a sense is the other way round- I set up a random dense grid to see just how much would be left; what percentage in the standard static, oscillator or other known simple patterns. For fun I also included a 'desert' with nothing in it, to see whether anything glided into it. Plus a lone glider starting in that strip but headed into the populated area. At one pixel per cell it's hard to see- so I think I may move to trying to move a magnifying glass over areas where an interesting pattern is developing.
Here's a part of the 'big picture' showing some known static and oscillators.
For the cell density I start at I don't think your approach would help- but haven't really thought it through. I was also surprised by the large fraction of time taken in my program actually setting the pixels.
|
|
|
Post by tenochtitlanuk on Nov 18, 2022 5:20:20 GMT -5
You might like to look at my page on drawing lines at www.diga.me.uk/bresenham.htmlI've used the Bresenham method ( see Rosetta Code) to draw dashed lines, dotted lines, and lines whose colour or width changes along their length or as a function of distance from start point.
|
|
|
Post by tenochtitlanuk on Nov 11, 2022 17:32:43 GMT -5
Could you clarify what the results should be? For me on Linux/Wine/LB I got the repeated set of sub-images shown below. Is that what is supposed to happen? I EXPECTED images 75x75 but not the row- repetition. nor for the edge cases to be as shown, since 1000/75 is non-integer. Sorry, I don't get it. My IM demo did what I expected.
|
|
|
Post by tenochtitlanuk on Nov 9, 2022 17:37:17 GMT -5
Old hands on the Forum will know I do such processing with ImageMagick. Straight off the 'net I found this code line... convert 8872x6472.bmp +repage -crop 1000x1000 tiles\tile%04d.bmp worked for me from the command line. I use LB under Linux/Wine. LB can call ImageMagick ( see the examples on my website) But simpler to do it yourself directly. I create a 8872x6472.bmp colour gradient file. Image shows the images the above command created in a few seconds- all the possible tiles. Lots of help online for how to select a particular single tile... INCIDENTALLY- tsh73 (anatoly) beat me to giving a native LB code example. My immediate reaction was why not use UpperLeftX and UpperLeftY to offset the graphic window off-screen, but with my setup at least LB doesn't use negatives. And I had thought it did! EDIT Ninja'd by Anatoly...
|
|
|
Post by tenochtitlanuk on Nov 4, 2022 18:25:08 GMT -5
Makes a nice demo of color filling to call the floodfill dll after drawing te outline. Redrawing as radii is too slow to make this effective.
You need to run the code below to see it draw the shape, surround it with black then go through a cycle of HSV colours...
nomainwin
WindowWidth =800 WindowHeight =800
open "Polar graphics" for graphics_nsb as #wg
#wg "trapclose quit"
hw =hwnd( #wg) calldll #user32, "GetDC", hw as ulong, hdc as ulong
pi = 3.14159265 a =150
n = 9
global col$
#wg "down ; fill darkblue ; backcolor darkblue ; color 0 255 255 ; up ; size 1"
for theta =0 to 2 *pi step 0.001 r =a *( 1 +0.9 *cos( 8 *theta))_ *( 1 +0.1 *cos( 24 *theta))_ *( 0.9 +0.1 *cos( 200 *theta))_ *( 1 +sin( theta)) if theta >0 then #wg "down" call plot r, theta print r, theta scan next theta
#wg "backcolor 0 0 0" ' this is colour to fill WITH targetcolor = 0 +255 *2^8 +255 *2^16 ' bu *2^16 +gn *2^8 this is colour to fill out TO ie desired border
x =1 y =1
calldll #gdi32, "ExtFloodFill", hdc as ulong,_ x as long, y as long,_ targetcolor as long,_ _FLOODFILLBORDER as long, result as long ' ie fill out with black 'til cyan is met.. so black surrounds.
call delay 1000
for i =0 to 999 CC =int( 360 *rnd( 1)) call hsv2rgb i /1000 *359, 0.99, 0.99 ' hue 0-359, saturation 0-0.99, value 0-0.99 ' alters global col$ #wg "backcolor "; col$ ' this is colour to fill WITH targetcolor = 0 +255 *2^8 +255 *2^16 ' bu *2^16 +gn *2^8 this is colour to fill out TO ie desired border
x =int( 1 +600 *rnd( 1)) y =int( 1 +600 *rnd( 1))
calldll #gdi32, "GetPixel", hdc as ulong, x as long, y as long, pixcol as ulong
if pixcol <>0 then calldll #gdi32, "ExtFloodFill", hdc as ulong,_ x as long, y as long,_ targetcolor as long,_ _FLOODFILLBORDER as long, result as long ' ie fill out 'til this colour is met.. scan end if
call delay 20 next i
#wg "getbmp scr 0 0 800 800" bmpsave "scr", "hash.bmp"
wait
sub plot r, theta #wg "goto "; 400 +r *cos( theta); " "; 660 -r *sin( theta) end sub
sub quit h$ calldll #user32, "ReleaseDC", hw as ulong, hdc as ulong, ret as void 'release the DCclose #h$ close #h$ end end sub
sub delay sleeptime calldll #kernel32, "Sleep", sleeptime as long, ret as void scan end sub
sub hsv2rgb h, s, v ' hue 0-360, saturation 0-1, value 0-1 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
function cosRad( t) cosRad =cos( t *pi /180) end function
function sinRad( t) sinRad =sin( t *pi /180) end function
|
|
|
Post by tenochtitlanuk on Nov 3, 2022 17:15:38 GMT -5
Happened on this on Wolfram Mathworld and just had to code it in LB! Code'll be on my website if you can't code polar coordinates!
|
|
|
Post by tenochtitlanuk on Oct 27, 2022 12:20:46 GMT -5
Did you follow the ReadMe 'alphaTestNotes.txt'?
What Pi OS do you have installed?
=== Raspberry Pi ===
Extract the lb5-353 folder to your home folder. cd to ~/lb5-353 Raspberry Pi - Use the rpi32-353 file: ./rpi32-353 lb5alpha.im
|
|