Fractals[LSystem]
LSystemPlot
Lindenmayer System Plot Generator
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
LSystemPlot(state, constants)
LSystemPlot(state, constants, opts)
state
-
string or Vector(integer) ; specifies the state of the LSystem, which is translated to a plot using constants
constants
list(character=string) or list(integer=string) ; a list characters or integers, with the corresponding plotting actions
opts
(optional) keyword options of the form opt=value where opt and value are described below
initialangle: keyword option of the form initialangle=value where value is a floating-point or integer number, which is the initial angle that the LSystem begins to plot with, when the LSystem is two dimensional. The default value is 0.
xinitialangle: keyword option of the form xinitialangle=value where value is a floating-point or integer number, which is the initial x-axis angle that the LSystem begins to plot with, when the LSystem is three dimensional. The default value is 0.
yinitialangle: keyword option of the form yinitialangle=value where value is a floating-point or integer number, which is the initial y-axis angle that the LSystem begins to plot with, when the LSystem is three dimensional. The default value is 0.
dimension : keyword option of the form dimension=2 or dimension=3, which determines the dimension of the plot. If no value is given then the dimension of the plot will be determined by constants.
All additional options are interpreted as plotting options.
The LSystemPlot command takes a state and reads through it in sequential order and uses the plotting actions defined in constants to translate each element in the state to a plotting action. These plotting actions are used to construct the plot of the LSystem. LSystem[Iterate] can be used to apply iterations to states, to create new states.
The state parameter is a sequence of characters. It can be input as string, or as Vector of integers in the range [1,255], whose values correspond to the ASCII values of the characters of the sequence.
The constants parameter of the LSystem is comprised of sequences of commands that are listed later. They can be input as a list(character=string), where the string is a sequence of plotting commands. When the state is read, each character or character corresponding to an ASCII value will cause the plotting commands corresponding to that character to be performed. The constants parameter can also be input as list(integer=string), where the string is once again a sequence of plotting commands. When the state is read, each ASCII value or ASCII value corresponding to a character value will cause the plotting commands corresponding to that ASCII value to be performed. For either input, if a character or ASCII value does not have a corresponding sequence of plotting commands in constants, it is assumed to perform no plotting commands.
LSystemPlot returns a plot of the LSystem state, with any plotting options used. The plot has no axes, black lines, and constrained scaling by default.
Plotting actions are of the form "command1:arg1;command2:arg2;...;commandN:argN;"
Available 2-D commands:
draw:n : Draws a line at the current angle of length n. n can be of type float or integer.
turn:n : Turns the current angle n degrees. n can be of type float or integer.
push:position or push:angle : pushes the current position or angle onto a stack. NOTE:position and angle are literal parts of the string and are not variables.
pop:position or pop:angle : pops the most recently pushed position or angle off the stack and sets it to the current position or angle.
Available 3-D commands:
turnx:n : Turns the current angle n degrees in the x-axis. n can be of type float or integer.
turny:n : Turns the current angle n degrees in the y-axis. n can be of type float or integer.
with⁡Fractals:-LSystem:
state≔F+F+F+F
cons≔F=draw:1,+=turn:-90
LSystemPlot⁡state,cons
rules≔F=FF+F++F+F
newstate1≔Iterate⁡state,rules
newstate1≔FF+F++F+F+FF+F++F+F+FF+F++F+F+FF+F++F+F
LSystemPlot⁡newstate1,cons
newstate2≔Iterate⁡newstate1,rules
newstate2≔FF+F++F+FFF+F++F+F+FF+F++F+F++FF+F++F+F+FF+F++F+F+FF+F++F+FFF+F++F+F+FF+F++F+F++FF+F++F+F+FF+F++F+F+FF+F++F+FFF+F++F+F+FF+F++F+F++FF+F++F+F+FF+F++F+F+FF+F++F+FFF+F++F+F+FF+F++F+F++FF+F++F+F+FF+F++F+F
LSystemPlot⁡newstate2,cons
state≔0
cons≔0=draw:0.5,1=draw:1,[=push:position;push:angle;turn:35,]=pop:position;pop:angle;turn:-35
rules≔1=11,0=1[0]0
newstate1≔1[0]0
newstate2≔11[1[0]0]1[0]0
The Fractals:-LSystem:-LSystemPlot command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
See Also
Iterate
LSystemExamples
Download Help Document