Closed zeffii closed 9 years ago
L-Tree, something that I never got to master. Even there is this node in Houdini, this single node is so complex and required a class of itself.
Would like to see what you come up with.
The recursive and fractal business is often a headache for me.
coool
read all the code comments...and the only place you have to modify code is those two lines..
a!!!
i changed many parameters. never read instructions ))
// variables
var bend = 2*(-35.5), // angle to twist (degrees)
i_max = 8, // limit, warning 10 is probably an upperlimit
i_user = Math.abs(Math.floor(7)), // scrub between 1 and upperlimit for recursion levels
iterations = Math.min(i_max, i_user), // number of rewrites (recursion levels in grammar)
F = 5890/(Math.pow(2.4,iterations)), // arm distance
angle_offset = to_rad(bend), // angle as radian
angle_rad = 0, // the current angle for drawing
x_start = 351, // drawing start x
y_start = 398, // drawing start y
x_current = x_start, // current cursor position x
y_current = y_start, // current cursor position y
rules = {}, // a map of the rules
commands = {}; // a map of the commands
already quite powerful, almost a direct port from the 2d .js
code written by Jeff Steward and myself. ( https://groups.google.com/d/msg/tributary/9kI-CGVVQb4/J6joc8q6VhwJ )
https://github.com/nortikin/sverchok/blob/master/node_scripts/templates/zeffii/L-system_initial.py
Next is pen up / pen down / store location / restore last stored location
updated the SN script to have more meaningful inputs. https://www.dropbox.com/s/qiydtv162aoz6ny/fast_rerwier_lsystem2bender.blend modify the bend factor, you'll see some interesting shapes.
Plans for the 3d implementation
It helps to think of the L-system as being 3d pen drawing with something akin to a 3d cursor to determine the point in 3d space.
down-mode
the pen connects any new vertices added to the last added vertex. up-mode
the pen breaks the current 'polyline' to allow us to move to a new (or stored) location and then start drawing a new polyline.[
is store current 3d pen position]
return pen to stored 3d position(
pen down)
pen upbecause simple -
and +
are only good for 2d drawing, a different single character convention will have to work to place the pen at a new 3d vector, rotated relative to the last vector. Thinking in sparse
X
(x ,0, 0)Y
(0, y, 0)Z
(0, 0, z)..still not fully settled on this
I'm looking forward to playing with this a lot.
close for now. It's not super important anyway.
@zeffii Animation Nodes is having L-System node, I have not tested your node either. But awesome implementation from artistic and design perspective.
@elfnor lsystem is GA_node.py That is it. use it, please
pushing example json to master in shapes. Slao there is Elfnor's Generative art node, that represent kind of L-systems as i understand.
In the past i've implemented this in Javascript in d3.js (live demo here) but it's only 2d. There are various ways to implement L-systems and i've wanted to do a 3d L-system for some time now.
http://algorithmicbotany.org/papers/abop/abop.pdf second time reading this now. this time slower :)