460 likes | 648 Views
Simplicity in Complexity. Rewriting Systems Classic Example: Koch 1905. Initiator. Generator. Rewriting Systems: Formal Grammars. Best understood rewriting systems are those that operate on character strings Chomsky 1956: formal grammars applied to natural languages
E N D
Rewriting SystemsClassic Example: Koch 1905 Initiator Generator
Rewriting Systems:Formal Grammars • Best understood rewriting systems are those that operate on character strings • Chomsky 1956: formal grammars applied to natural languages • Backus & Naur 1959: rewriting notation applied to formal definition of programming language (ALGOL-60) • Lindenmayer 1968 introduced a new type of rewriting system, subsequently termed L-systems • Essential difference between Chomsky grammars and L-systems is that in L-systems productions are applied in parallel.
Deterministic, Context Free L-Systems (DOL) Grammar: Derivation:
Formal Definition of L-System 100% Real Math
Formal Definition of Derivation 100% Real Math
Turtle Interpretation of StringsAbelson & diSessa (MIT 1982) The state of the turtle is defined as an ordered triplet, where the cartesian coordinates represent the turtle’s position, and the angle a, called the heading, is interpreted as the direction in which the turtle is facing. Where am I? a
Turtle Interpretation of Character String Character Interpretation F f + -
Turtle Interpretation of a String String: FFF-FF-F-F+F+FF-F-FFF d = 90 - +
Example of Turtle Interpretation:Quadratic Koch Island The L-System:
Sequence of Koch Curves Obtained byModification of Production Successor
General Edge Rewriting The Koch constructions are a restricted case of general edge rewriting, where there can be more than one edge letter, interpreted by the turtle as “move forward”. Examples:
Example of FASS Curves Generated byEdge-rewriting FASS = space-filling, self-avoiding, simple, and self-similar
Node Rewriting:Turtle Interpretation Aligned with turtle state here: Turtle resumes here: Subfigure A PA QA
U H L Modeling in Three Dimensions
Symbols to Control Turtle Orientation in Space Symbol Turtle Semantics + Turn left by angle d, using rotation matrix Ru(d) - Turn right by angle d, using rotation matrix Ru(-d) & Pitch down by angle d, using rotation matrix RL(d) ^ Pitch up by angle d, using rotation matrix RL(-d) \ Roll left by angle d, using rotation matrix RH(d) / Roll right by angle d, using rotation matrix RH(-d)
Branching Structures:Axial Trees • At each node at most one outgoing straight segment is distinguished • The first segment in the sequence originates at the root of the tree or as a lateral segment at some node • Each subsequent segment is a straight segment • The last segment is not followed by any straight segments
Tree OL-Systems e d e d c s b c s b a a Production T1 T2
Bracketed OL-Systems Turtle semantics: [ Push the current state of the turtle onto a stack. The information saved contains the turtle’s position and orientation, and possibly other attributes such as color, segment width ] Pop a state from the state and make it the current state of the turtle. No line is drawn, although in general the position of the turtle changes Example: d=45 F[+F][-F[-F]F]F[+F][-F]
Stochastic OL-Systems 0.34 0.33 0.33
Parametric DOL-Systems Formal Parameters Actual Parameters Module Condition L-System: Derivation:
Parametric DOL Systems • A production matches a nodule in a parametric word if the following conditions are met: • The letter in the module and the letter in the production predecessor are the same • The number of actual parameters in the module is equal to the number of formal parameters in the production predecessor • The condition evaluates to true if the actual parameter values are substituted for the formal parameters in the production
Turtle Interpretation of Parametric Words If one or more parameters are associated with a symbol interpreted by the turtle, the value of the first parameter controls the turtle’s state. If the symbol is not followed by any parameters, default values specified ooutside the L-system are used as in the non-parametric case. The basic set of symbols affected by the introduction of parameters is listed below: F(a) Move forward a step of length a > 0. f(a) Move forward a step of length a without drawing a line +(a) Rotate around U by an angle of a degrees &(a) Rotate around L by an angle of a degrees /(a) Rotate around H by an angle of a degrees
Developmental Surface Models Consider the following L-system:
Examples of Compound Leaves Generated byL-System of Slide 38
Examples of Compound Leaves Generated byL-System of Slide 38
General Branching Patterns • Terminal: main apex and all lateral apices terminate • Sympoidal: main apex terminates; some lateral apices continue • Monopoidal: main apex continues; all lateral apices terminate • Polypoidal: main apex continues; some lateral apices also continue
Inflorescences: Compound Flowering StructuresRacemes: Monopoidal Inflorscences Generating Partial L-System: L: leaf I: Internode K: Flower