algorithmic modeling for Rhino
Comment
Thanks for your explanations Dani. Impressive work, once again.
ValueB will be 18*, not 12 xD
No, the parse has no problems, in fact I only need to parse the rules and axiom, each piece (as F or F(Len: Pow(0.8,BL)) or + or [) becomes a module (custom class) and their descendants are chosen from rhe rules dictionary. And to read the expressions/operations of type string (as x+0.5) I use the NCalc library.
For now I have done the LS generator and interpretation (which generates the lines) into independent parts, it would be easy to make if a new line is very close to another, the whole branch (with following) is pruned. But my idea was to access the geometry from the attributes/metadata, for example F = IF(F.To Dist Tree < 0.2, F.Cull, F) where F.To means the end point of the line, Dist measures de distance, Tree is all current lines of the tree and F.Cull a method to prune that branch. But I'm still far from this approach.
The difficult part is finding the most efficient/fewer lines of code system that works globally. You know, if you improve a part, another breaks. I have a feeling that there must be a simpler way that I currently have, and there are plenty of things that can be changed/added. I also want to find a good way to allow other developers to interpret the results for other purposes other than creating a tree, for example, make a fractal on a mesh, F instead of moving forward would be to subdivide face or something.
Much remains to be done, but very exciting :)
Non-deterministic is like a global adjective for the system, and stochastic mean that we can use probabilities to give one or the other result (well, is determined by a seed, but I have seen it is given that name). For example, in my grammar:
F = FX
X = %(50:F[-X][+X]; 30:F[-X][X][+X]; 20:F[X])
Axiom => F
0 - F
1 - FX
2 - FF[-X][+X] with some seed, or FF[-X][X][+X] with other seed, or FF[X] with other.
And context-sensitive means, for example in my grammar, the rule:
X = >(-F:+FX; +F:F[-F[-X][+FX]])
if the previous symbols (in the string of L-System, on the left when a X is read) is a -F, then X will be +FX, but if the symbol is +F, then X will be F[-F[-X][+FX]].
Or:
X = G(2: +++F; 3:++F; 4:+F) means that in the second generation X will be +++F, in the fourth will be +F.
Or:
X = IF(BL = 3: +F, -F) It means that if the branch level (BL) of X is 3, will be +F, otherwise -F.
And parametric is something like:
F = F(ValueA:x+0.5; ValueB: 6*BL), F have two metadata (ValueA and ValueB), and when "x" is read, is replaced by the value of that attribute of his predecessor, ie, will be the ancestor valueA+0.5. And BL is the branch level of X, which means that if X have a Path like {0,0,1} or {0,3,0} (three indices), ValueB will be 12, for that X in that generation/iteration.
I'm developing a non-deterministic, stochastic, context-sensitive, parametric and with topology L-System generator for the next version of PhylloMachine.
It work in all contexts (the image shows a parametric context (as metadata that are inherited) where new each branch is exponentially lower than the previous in length), but I still have a lot of work debugging and making it even simpler.
The difficult will be to implement this in the logic of PhylloMachine, but I am convinced it will be worth the effort. I hope that at the end of summer I can share it. :)
Nice:) Did you invent some sort of custom L-system Dani?
Hi,Daniel how can you do this? Please give me some hint,thx
© 2019 Created by Scott Davidson. Powered by
You need to be a member of Grasshopper to add comments!
Join Grasshopper