Frequently asked questions
List and explanation of all properties usable in L-systems
Q: Whey I'm exploring the gallery I can see many different properties like continuousColoring
or initialAngle
used in L-systems. Where can I find complete list with explanation?
A: Properties depends on used components in process configuration. If you use predefined process configurations like SvgRenderer
or SymbolPrinter
there is consolidated list of all properties in Predefined process configurations section of documentation.
Recently was added list of some properties directly on process page. It will show documentation for used process configurations so you have to use some first (for example with: process all with SvgRenderer;
). It looks like this, try to hover over links (JavaScript must be enabled):
Symbol rewriting is not working properly!
Q: In following L-system rewriting do not work, nothing is rendered:
1 2 3 4 5 6 7 | lsystem RewritingProblem { set symbols axiom = F; set iterations = 2; interpret F as DrawForward(10); rewrite F to FFF; } process all with SvgRenderer; |
A: Problem is in symbols, FFF
is one symbol for Malsys, you need to separate individual symbols with space to F F F
. This problem can be easily debugged setting debugInterpretation
property to true. If you do so you will see FFF =>
which means that symbol FFF
was interpreted as nothing which is correct to L-system definition.
1 2 3 4 5 6 7 8 | lsystem RewritingProblem { set symbols axiom = F; set iterations = 2; set debugInterpretation = true; interpret F as DrawForward(10); rewrite F to FFF; } process all with SvgRenderer; |
How to render animated L-systems
Q: I saw some animations in gallery, how to do them?
A: There are more ways. The simplest way is to render individual frames with set interpretEveryIteration = true;
and then download all images and make animation by your own. However, this will not allow you to publish animations in Malsys' Gallery.
Malsys can generate animations in animated PNG format (APNG). This format is not supported by all browsers. I order to generate APNG in Malsys, you need to use AnimationRenderer
. Following example is animated Dragon curve.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | lsystem DragonCurve { set symbols axiom = L(400); set iterations = 14; // interpret every iteration to form an animation set interpretEveryIteration = true; // set canvas origin and size to ensure that all // frames have the same size set canvasOriginSize = {-100, -150, 650, 440}; let sq2 = sqrt(2); rewrite R(d) to - R(d / sq2) + + L(d / sq2) -; rewrite L(d) to + R(d / sq2) - - L(d / sq2) +; interpret R L as DrawForward(0, 3); interpret + as TurnLeft(45); interpret - as TurnLeft(-45); } process all with AnimationRenderer; |
Important parts are set interpretEveryIteration = true;
and set canvasOriginSize = {-100, -150, 650, 440};