|
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
|
|
|
Post by tenochtitlanuk on Oct 19, 2022 14:21:10 GMT -5
Animated gif of result.. Looks better run in LB of course!
|
|
|
Post by tenochtitlanuk on Oct 18, 2022 16:08:20 GMT -5
We are coming up to the Fifth of November, when Brits celebrate with fire and fireworks. It has usually-forgotten origins in an attempt to overthrow a king ( hurray!) or Parliament ( Boo!) or Catholicism- but even further back in ancient autumn season celebrations. I decided to throw together a seasonal animation- set fire to a fuse which wanders round the screen but never crosses itself, and finally detonates. And use my own LB/JB fill routines so it would run on each platform, rather than the dll route.
Draw by hand a single-pixel wide trace in black on a near-black background without crossing- almost impossible 'cos you can't see the track. So, at first, use a colour like red. Yup, nice wiggly trace to the centre. Start a fill- and find it stops at some random place. Try drawing a 2-pixel trace. Now it stops somewhere and goes back to the reds it missed on its curtailed path! Do a bit of thinking and screen-magnifying.Ahah! It's a problem when you HAVE to fill diagonally. Von Neumann or Moore neighbourhoods to any one familiar with the Game of Life. So -rewrite my fill to include diagonal steps as well as vertical/horizontal. Nearly right- but there is still a hidden problem, especially if you allow thicker parts of the fuse... anyway..... here's a Zip file file which is a working version. Not optimised- I wanted a slow fuse! PS The zipfile name is a tribute to a song of my youth- dedicated to the downtrodden and oppressed of Watts and other ghettos...
|
|
|
atan2
Sept 26, 2022 11:45:30 GMT -5
Post by tenochtitlanuk on Sept 26, 2022 11:45:30 GMT -5
Just a nice graphic to confirm I CAN draw arcs reliably! Shades of Sauron's eye, with hgv colouring. This example was created with the arc-ends and radial centre marked. Wihout them and with more arcs drawn you get a smoother but less dramatic pic! This thread also led me to examine the dot.product method. Thanks, friends..
|
|
|
atan2
Sept 23, 2022 6:55:03 GMT -5
Post by tenochtitlanuk on Sept 23, 2022 6:55:03 GMT -5
Many of us have found atan2, which takes variables y and x and gives an angle, to be very useful. I know I've coded it myself, and seen/used versions by Chris Iverson /Anatoly /B+ /Steelweaver /Rod /etc. Trouble is it is only needed infrequently. Recently, playing with arcs, I realised there are two common algorithm /definition versions in circulation. Checking on wikipedia- atan2 I find there is little consistency across programming languages. Up to 8 versions can be considered to exist, depending on whether you regard angles as being measured clockwise or anti-clockwise, and from which axis/direction regarded as zero. And you can define atan2 as giving results in the range 0 to 2 pi, or from -pi/2 to +pi/2!! No wonder I've sometimes got weird results and had to do a bit of fiddling! Just another symptom of my aging brain!
|
|