User:Laurier Rochon/prototyping/l-systems: Difference between revisions

From XPUB & Lens-Based wiki
Line 3: Line 3:
Discovery of the day : TURTLE! (not TurtleWorld, the library)
Discovery of the day : TURTLE! (not TurtleWorld, the library)


It actually appears that Python has built-in turtle graphics, meaning that we can bypass BOB (being in the 'swampy folder' etc., and just use a 'pointer' triangle, with much clearer methods. [http://docs.python.org/library/turtle.html|This] is the page for it. It's well documented - for example, you can use 'setcoords(x,y)' to set the pointer at the right spot. The method 'getheading' is also tremendously useful in knowing what angle bob is oriented towards. One big problem with turtle vs turtle world : it's slowwwwwwwwwwwwww. Max speed is '10', which equates to about '1' in Turtle World terms.
It actually appears that Python has built-in turtle graphics, meaning that we can bypass BOB (being in the 'swampy folder' etc., and just use a 'pointer' triangle, with much clearer methods. [http://docs.python.org/library/turtle.html This] is the page for it. It's well documented - for example, you can use 'setcoords(x,y)' to set the pointer at the right spot. The method 'getheading' is also tremendously useful in knowing what angle bob is oriented towards. One big problem with turtle vs turtle world : it's slowwwwwwwwwwwwww. Max speed is '10', which equates to about '1' in Turtle World terms.


---
---

Revision as of 01:00, 13 June 2011

L-Systems

Discovery of the day : TURTLE! (not TurtleWorld, the library)

It actually appears that Python has built-in turtle graphics, meaning that we can bypass BOB (being in the 'swampy folder' etc., and just use a 'pointer' triangle, with much clearer methods. This is the page for it. It's well documented - for example, you can use 'setcoords(x,y)' to set the pointer at the right spot. The method 'getheading' is also tremendously useful in knowing what angle bob is oriented towards. One big problem with turtle vs turtle world : it's slowwwwwwwwwwwwww. Max speed is '10', which equates to about '1' in Turtle World terms.

---

Using basic transformation rules such as :

  • Axiom: F-F-F-F
  • Rule : F -> FF-F-F-F-FF
  • Angle: 90
  • Steps: 4

What the symbols mean

  • F is forward by X pixels
  • + is turn Y degrees
  • - is turn -Y degrees
  • [ is record the current state
  • ] restore the matching last ] state

Will yield something like :

Screenshot-3.png

Other set of rules...

Sss1.png