Dark Bit Factory & Gravity

PROGRAMMING => Freebasic => Topic started by: Merick on October 24, 2009

Title: L-system interpreter
Post by: Merick on October 24, 2009
I've been working on an L-system interpreter, based on the info in this document: http://www.inf.uni-konstanz.de/cgip/bib/files/Saupe88b.pdf

I've got the string replacement itself working but when I try to draw it the angles are off, can anyone help?
Title: Re: L-system interpreter
Post by: Voltage on October 24, 2009
Nice one, looking good.

The problem is your angle overflows.... Should be 360, instead of 359.... like below.

Code: [Select]
Case "+"
angle += ang
If angle > 359 Then angle -= 360
Case "-"
angle -= ang
If angle < 0 Then angle += 360
Case "|"
angle += 180
If angle > 359 Then angle -= 360
Title: Re: L-system interpreter
Post by: Merick on October 24, 2009
oy, thanks

now i can start working on the other stuff i have planned for this
Title: Re: L-system interpreter
Post by: Merick on November 14, 2009
Here's a new version, with the ability to load and save rule sets (and a very simplistic text interface)

When I try to run the plant.rl, it crashes if I try to do more than 2 iterations

*edit*

fixed that

Now I just need some help with ratios. In my code, the get_curve_size sub is used to calculate the min and max coords of the finished image, then it uses the window command to reset the coordinate system to a box just slightly larger than that, but this method is causing distortion in the image. I need a formula to re-calculate the min and max coords for the virtual coordinate system while keeping it to the actual ratio of the graphics window.