• Welcome to Dark Bit Factory & Gravity.
 

L-system interpreter

Started by Merick, October 24, 2009

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Merick

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?

Voltage

Nice one, looking good.

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

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
Challenge Trophies Won:

Merick

oy, thanks

now i can start working on the other stuff i have planned for this

Merick

#3
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.