nylki / lindenmayer

Feature complete classic L-System library (branching, context sensitive, parametric) & multi-purpose modern L-System/LSystem implementation that can take javascript functions as productions. It is not opinionated about how you do visualisations.
MIT License
182 stars 14 forks source link

match() should work for objects and return matched object params #2

Closed nylki closed 8 years ago

nylki commented 8 years ago

Returning matched objects in context sensitive L-Systems is useful if you want to modify those (neighboring) objects. For example nutrients trickling up a tree: you may check if a leaf L has a branch F via F<L. That L could the syphon some virtual F.water of that into itself (L.water) for example, to simulate nutrition flow.

nylki commented 8 years ago

implemented in https://github.com/nylki/lindenmayer/commit/212c6d7b3d64bb9eae7a46c126d97f61e1d74a81

However modification naturally works only for the right side of, as the left side got already processed by the L-System.