Tuto: L System rewriting method: the arrowhead of Sierpinski

Few months ago, I tried fractal curves with Xgen when the loop function was released. Yet, the way I did it, was not quite academic . This time, I wanted to follow the "rewriting" method, as much as I understood it. Usage of "Select" function following Bertrand Faure video was really helpful (thank you @BFhttps://www.youtube.com/watch?v=kmZnq7jJ1qI).

as a trial: the arrowhead of Sierpinski. 

https://en.wikipedia.org/wiki/Sierpi%C5%84ski_curve

Sierpiński curve - Wikipedia

en.wikipedia.org

Alphabet: A, B

Constants: F (move forward), + (turn right), − (turn left)

Axiom: A

Production rules:

A → B-A-B ;  B -> A+B+A 

A and B trigger F

Angle: 60

in my model, A=1 B=2 +=3 -=4

the algorithm is in 2 parts

  1.  substitution of the axiom by production rules -> generate a list (2,4,1,4,2) etc
  2.  creation of the base points (the turtle's positions) step by step using the list to select the right action (translate, rotate, translate etc)

I modeled a user feature to translate the turtle along its local axis.

the template is at the end of the post. let me know if any issue for the people that will make a try.


1 substitution of the axiom by production rules

2 creation of the base points (the turtle's positions)

3 creation of the final shape

template:

​​​​​​​​​​​​​​