90 likes | 199 Views
Plant Modeling using L-Grammars. Andreea Francu - afrancu@caip Department of Electrical and Computer Engineering. L-Grammars. Parallel grammars with one type of symbols Used to generate strings A string describes a 2D or 3D scene contains commands for a Turtle Graphics interpreter.
E N D
Plant Modeling using L-Grammars Andreea Francu - afrancu@caip Department of Electrical and Computer Engineering
L-Grammars • Parallel grammars with one type of symbols • Used to generate strings • A string • describes a 2D or 3D scene • contains commands for a Turtle Graphics interpreter
Turtle F + F - F Start Turtle Graphics • A turtle accepts commands: • forward (F), turn left (+), turn right (-) • 3D commands: & ^ / \ • example: F-F+F • Commands are relative to the coordinates of the turtle
L-Grammar Applet • Visualizing tool for L-Grammars • Predefined grammars • Accepts new grammars • Components: • Grammar parser • Grammar derivator • 3D model generator • 3D model visualizer
L-Grammar Applet • Grammar parser • translates user input into grammar internal format • Grammar derivator • keeps current derivation • constructs new derivations by substituting left-hand sides with their productions • 3D model generator • implements Turtle Graphics engine • generates a 3D model with lines and polygons • 3D model visualizer • perspective projection of the 3D model
Example: 2D Trees O->ULFFF U->[+++G][---G]TU G->+H[-G]L H->-G[+H]L T->TL L->[-FFF][+FFF]F X->F-[[X]+X]+F[+FX]-X F->FF F->FF-[-F+F+F]+[+F-F-F]
Conclusions • L-Grammars are the standard way to generate realistic images of plants • Small representation for large 3D models • database amplification • Grammar complexity increases dramatically when describing • angles, lengths, thickness, colors, textures, tropism