Author Topic: L-system interpreter  (Read 4283 times)

0 Members and 1 Guest are viewing this topic.

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
L-system interpreter
« 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?

Offline Voltage

  • Professor
  • Pentium
  • *****
  • Posts: 857
  • Karma: 53
    • View Profile
Re: L-system interpreter
« Reply #1 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
Challenge Trophies Won:

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
Re: L-system interpreter
« Reply #2 on: October 24, 2009 »
oy, thanks

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

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
Re: L-system interpreter
« Reply #3 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.
« Last Edit: November 26, 2009 by Merick »