LSystem Plot - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Fractals[LSystem]

  

LSystemPlot

  

Lindenmayer System Plot Generator

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

LSystemPlot(state, constants)

LSystemPlot(state, constants, opts)

Parameters

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

Options

• 

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.

Description

• 

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:

– 

draw:n : Draws a line at the current angle of length n. n can be of type float or integer.

– 

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.

– 

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.

Examples

withFractals:-LSystem:

stateF+F+F+F

stateF+F+F+F

(1)

consF=draw:1,+=turn:-90

consF=draw:1,+=turn:-90

(2)

LSystemPlotstate,cons

rulesF=FF+F++F+F

rulesF=FF+F++F+F

(3)

newstate1Iteratestate,rules

newstate1FF+F++F+F+FF+F++F+F+FF+F++F+F+FF+F++F+F

(4)

LSystemPlotnewstate1,cons

newstate2Iteratenewstate1,rules

newstate2FF+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

(5)

LSystemPlotnewstate2,cons

state0

state0

(6)

cons0=draw:0.5,1=draw:1,[=push:position;push:angle;turn:35,]=pop:position;pop:angle;turn:-35

cons0=draw:0.5,1=draw:1,[=push:position;push:angle;turn:35,]=pop:position;pop:angle;turn:-35

(7)

LSystemPlotstate,cons

rules1=11,0=1[0]0

rules1=11,0=1[0]0

(8)

newstate1Iteratestate,rules

newstate11[0]0

(9)

LSystemPlotnewstate1,cons

newstate2Iteratenewstate1,rules

newstate211[1[0]0]1[0]0

(10)

LSystemPlotnewstate2,cons

Compatibility

• 

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