View Full Version : Another L-System fun
Petr Schreiber
08-05-2008, 19:30
Hi,
Emil Menzel on powerBasic forum (http://www.powerbasic.com/support/pbforums/showthread.php?t=37325) did very nice demo on turtle graphics, which inspired me to combine turtle graphics and L-Systems once again :)
I created header with basic Lindenmayer system (http://en.wikipedia.org/wiki/L-system) functions + little sample.
After longer time I really took advantage of thinBASIC hot features like VARIANTs in UDTs and calling function by name.
So now you can assign to symbol "F" function "moveForward" ( or anything you like ) and watch the L-System results.
Hope you will like it,
Petr
P.S. This version is the most easy to use I ever did, but on other side I did not optimized it at all :P ( yet )
Very nice. :)
I've always liked Turtle Graphics, at my first Junior School there was a BBC Microcomputer which had a drawing robot made from Lego connected to it. You could use the Turtle program to move the robot around & it would draw shapes on the floor.
Petr Schreiber
08-05-2008, 19:52
Thanks :),
I remember something similar,
wasn't it called "Karel the Robot" or something like that ?
I think also LOGO worked similar...
Bye,
Petr
P.S. BBC Micro looks cool :)
...wasn't it called "Karel the Robot" or something like that ?..
Lol, I think our Robot had been made by one of the teachers.
Most of the time it didn't work. :D
Petr Schreiber
08-05-2008, 20:04
... then it was deadly educative tool ;D
I attached new sample with fractal plant, just grand theft from Wiki again
Petr
EDIT: Added 2D version of demo 2, showing multiple generations
The new programs look good. :)
Some time ago I found this (http://www.indsys.chuo-u.ac.jp/~watlab/fractal.html) page on the Internet which you might find interesting.
The page is in Japanese & it contains 4 Fractal programs written in QBASIC, it also features some images of what you'll see when you run the programs.
ErosOlmi
08-05-2008, 20:47
Hey Petr,
what clever advanced techniques! Merit a karma point. even 2 ;)
Eros
Petr Schreiber
08-05-2008, 22:34
:)
Thanks Eros,
I like L-systems a lot, as they are quite abstract, they can serve for many things.
Matthew, I am not good at Japanese :D, but my friend is, I must contact him to reveal those characters :)
In the meantime, here is conversion of the Japanese code.
Thanks to new tbgl_rendermatrix2d functionality the images must not be upside down anymore.
Petr
CODE REMOVED, see new version in first post
I don't know how I missed this topic, those are really neat guys. Thanks a lot!!
sandyrepope
10-05-2008, 01:27
When I ran this script all I saw was a black background in the window. I've tried pressing different f-buttons (f1-f4). What should I see?
Thanks
Sandy
Hmm, I just downloaded the script containing the programs from that Japanese site & I only get a Black background too. :(
Petr Schreiber
10-05-2008, 11:03
Hi,
I am stupid :D
In Code4() there was missing TBGL_EndPoly, I am sorry :-[.
NVIDIA drivers tolerate too much of my mistakes, I should develop on unforgiving Intel :)
Please try again if you can,
latest version attached to the first post is :)
Petr
Okay Petr I just downloaded the new version & it's working correctly. :)
Petr Schreiber
10-05-2008, 20:17
Thanks for confirmation,
I am happy it worked for you
Petr
sandyrepope
11-05-2008, 03:20
It works for me, too.
Thanks
Sandy