Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), 27-28 September, 2010 Winfried Kurth Some.

Slides:



Advertisements
Similar presentations
Jason Stredwick, MSU 2004 L-Systems Lindenmayer Systems algorithmicbotany.org.
Advertisements

C O N T E X T - F R E E LANGUAGES ( use a grammar to describe a language) 1.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
L-System Aristid Lindenmayer (1968), biologist. L-System A method of constructing a FRACTAL that is also a MODEL for plant growth. The Computational Beauty.
Shared Graphics Skills Cameras and Clipping Planes
Turing Machines (At last!). Designing Universal Computational Devices Was Not The Only Contribution from Alan Turing… Enter the year 1940: The world is.
So far we’ve done… Dynamics and chaos Thermodynamics, statistical mechanics, entropy, information Computation, Turing machines, halting problem Evolution,
L systems (Aristid Lindenmayer)
L-systems Presented by Luv Kohli COMP258 October 30, 2002 Images copyright © 1992 D. Fowler, P. Prusinkiewicz, and J. Battjes.
Procedural Modeling L-Systems Procedural Terrain Procedural Behavior Based on the slides from Spring 2007.
Simulating Trees with Fractals and L-Systems Eric M. Upchurch CS 579.
Synthetic Topiary. Premislaw Prunsinkiewicz (Prof. P) Mark James Radomír Měch.
Approaches To Infinity. Fractals Self Similarity – They appear the same at every scale, no matter how much enlarged.
IlliDOL: A Framework for Exploration of L- Systems in Three Dimensions Vilas Dhar Math 198 Spring 2003.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Modelling.
XL as an extension of the L-system formalism Tutorial "Modelling Plants with GroIMP", Cottbus, March 11-12, 2008 Winfried Kurth Ole Kniemeyer Reinhard.
Chapter 2 Syntax A language that is simple to parse for the compiler is also simple to parse for the human programmer. N. Wirth.
Dragon Curve Drawn in Project 4… How to generate the string of drawing commands? How does the dragon curve come about? 1.
UNIVERSITI MALAYSIA PERLIS
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Tutorial „Modelling in the language XL“ University of Göttingen (Germany), September 21/22, 2009 Winfried Kurth Some basic examples in XL (part 1) related.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
L-Systems and Procedural Plants CSE 3541 Matt Boggus.
College of Computer and Information Science, Northeastern UniversityOctober 13, CS U540 Computer Graphics Prof. Harriet Fell Spring 2007 Lecture.
The Artificial Life of Plants Przemyslaw Prusinkiewicz, Mark Hammel, Radom´ır Mˇech Department of Computer Science University of Calgary Calgary, Alberta,
Programming With C.
Examining the World of Fractals. Myles Akeem Singleton Central Illinois Chapter National BDPA Technology Conference 2006 Los-Angeles, CA.
Pushdown Automata (PDAs)
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Basic examples.
L-Systems Lindenmayer Systems Prusinkiewicz and Lindenmayer
Main Points: - Python Turtle - Fractals
Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011.
L-system and SVG 2D SVG Tree 2002/10/16.
Evolutionary Robotics Using A Formal Grammar To Evolve Robot Bodies and Brains Hornby, G.S., Pollack, J. (2001) Creating high-level components with a generative.
How to Draw a Tree L-Systems in Computer Graphics Steven Janke.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
TextBook Concepts of Programming Languages, Robert W. Sebesta, (10th edition), Addison-Wesley Publishing Company CSCI18 - Concepts of Programming languages.
1 10/27/ :26 UML Simplicity in Complexity. 2 10/27/ :26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Tutorial and workshop „Modelling with GroIMP and XL“ / Tutorial for beginners University of Göttingen, 27 February, 2012 Winfried Kurth Introduction to.
LINDFERN Lindenmayer Systems in VPython Nick Langhammer.
Language Translation A programming language processor is any system that manipulates programs expressed in a PL A source program in some source language.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
1 Programming Project #2 (Moldels of Computation, Spring, 2001) Due: April 20 (Friday) This assignment is the second half of the programming project which.
Experimenting with Grammars to Generate L-Systems October 29, 2007
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
Tutorial „Modelling in the language XL“ University of Göttingen (Germany), September 21/22, 2009 Winfried Kurth Some basic examples in XL (part 2) related.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Computer Graphics I, Fall 2010 Geometry.
Turtle Graphics Lesson 2 1. There are 3 homeworks to complete during the six lessons of this unit. Your teacher will let you know when a homework has.
Linux Administration Working with the BASH Shell.
Experimenting with Grammars to Generate L-Systems – in JFLAP March 31, 2011 Prof. Susan Rodger Computer Science Dept.
Grammars, L-Systems Jim Whitehead UC Santa Cruz School of Engineering courses.soe.ucsc.edu/courses/cmps265/Spring14/01 23 Apr 2014.
Regular Expressions, Backus-Naur Form and Reverse Polish Notation
Do it now activity Last lesson we used Flowol to create a solution to a problem a computer could solve. Identify what each symbol does:
L-systems L-systems are grammatical systems introduced by Lyndenmayer to describe biological developments such as the growth of plants and cellular organisms.
ATCM 3310 Procedural Animation
Turing Machines (At last!).
Interpretive rules and instantiation rules
Recursion Definition: A method that calls itself. Examples
Tutorial 10: Programming with javascript
Chapter 5 Recursion.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 2, 09/04/2003 Prof. Roy Levow.
Presentation transcript:

Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some basic examples in XL (part 1) related material: XL code files sm09_e??.rgg URL and drive T:\rgg on CIP pool stations

F0 RU(90) F0 RU(90) LMul(0.5) F0 turtle geometry

Turtle geometry „turtle": virtual device for drawing or construction in 2-D or 3-D space - able to store information (graphical and non- graphical) - equipped with a memory containing state information (important for branch construction) - current turtle state contains e.g. current line thickness, step length, colour, further properties of the object which is constructed next

Turtle commands in XL (selection): F0 "Forward", with construction of an element (line segment, shoot, internode...), uses as length the current step size (the zero stands for „no explicit specification of length") M0 forward without construction (Move) L(x) change current step size (length) to x LAdd(x) increment the current step size to x LMul(x) multiply the current step size by x D(x), DAdd(x), DMul(x) analogously for current thickness

Repetition of substrings possible with " for " e.g., for ((1:3)) ( A B C ) yields A B C A B C A B C what is the result of the interpretation of L(10) for ((1:6)) ( F0 RU(90) LMul(0.8) ) ?

L(10) for ((1:6)) ( F0 RU(90) LMul(0.8) )

further example: for ((1:20)) ( for ((1:36)) ( F0 RU(165) F0 RU(165) ) RU(270) )

further example: for ((1:20)) ( for ((1:36)) ( F0 RU(165) F0 RU(165) ) RU(270) )

Extension to 3-D graphics: turtle rotations by 3 axes in space

head left up Extension to 3-D graphics: turtle rotations by 3 axes in space

RH RL RU Extension to 3-D graphics: turtle rotations by 3 axes in space

3-D commands: RU(45) rotation of the turtle around the "up " axis by 45° RL(... ), RH(... ) analogously by "left" and "head" axis up-, left- and head axis form an orthogonal spatial coordinate system which is carried by the turtle RV(x) rotation "to the ground" with strength given by x RG rotation absolutely to the ground (direction (0, 0, -1))

Example: L(100) D(3) RU(-90) F(50) RU(90) M0 RU(90) D(10) F0 F0 D(3) RU(90) F0 F0 RU(90) F(150) RU(90) F(140) RU(90) M(30) F(30) M(30) F(30) RU(120) M0 Sphere(15) generates

Branches: realization with memory commands [ put current state on stack ("Ablage", Stack) ] take current state from stack and let it become the current state (thus: end of branch!) F0 [ RU(-20) F0 ] RU(20) DMul(2) F0

How to execute a turtle command sequence with GroIMP write into a GroIMP project file (or into a file with filename extension.rgg ): protected void init() [ Axiom ==> turtle command sequence ; ]

Example: Drawing a triangle protected void init() [ Axiom ==> RU(30) F(10) RU(120) F(10) RU(120) F(10) ] see file sm09_e01.rgg

rule systems for the replacement of character strings in each derivation step parallel replacement of all characters for which there is one applicable rule interpreted L-systems: turtle command language is subset of the alphabet of the L-system L-systems (Lindenmayer systems) Aristid Lindenmayer ( ) Remember:

Example: rules A ==> F0 [ RU(45) B ] A ; B ==> F0 B ; start word A ( A and B are normally not interpreted geometrically.) interpretation by turtle geometry

example space filling curve: Axiom ==> L(10) RU(-45) X RU(-45) F(1) RU(-45) X; X ==> X F0 X RU(-45) F(1) RU(-45) X F0 X traditional Indian kolam „Anklets of Krishna“

example for a fractal: Koch curve Axiom ==> RU(90) F(10); F(x) ==> F(x/3) RU(-60) F(x/3) RU(120) F(x/3) RU(-60) F(x/3)

.

cf. sample file sm09_e02.rgg : closed Koch curve, developed from triangle protected void init() [ Axiom ==> RU(50) F(10) RU(120) F(10) RU(120) F(10); ] // public method for interactive usage in GroIMP // (via button): public void application() // rules must be set in [] and finished with ; [ // each F() is replaced by 4 smaller F() // the length of the F on the left-hand side is taken over // by x to the right-hand side F(x) ==> F(x/3) RU(-60) F(x/3) RU(120) F(x/3) RU(-60) F(x/3); ]

example with branching: F0 ==> F0 [ RU(25.7) F0 ] F0 [ RU(-25.7) F0 ] F0 ; Result after 7 steps: (start word L(10) F0 )

sample file sm09_e03.rgg : /* You learn at this example: - how to construct a simple plant model (according to architectural model Schoute) - how to specify branches with [ ] */ // Example of a simple tree architecture (Schoute architecture) // Extensions to the standard alphabet //Shoot() is an extension of the turtle-command F() and stands for an annual shoot module Shoot(float len) extends F(len); // Bud is an extension of a sphere object and stands for a terminal bud // its strength controls the length of the produced shoot in the next timestep module Bud(float strength) extends Sphere(0.2) {{ setShader(RED); setTransform(0, 0, 0.3); }}; // protected void init () [ // start structure (a bud) Axiom ==> Bud(5); ] public void run () [ // a square bracket [] will indicate a branch // (daughter relation) // Rotation around upward axis (RU) and head axis (RH) // Decrease of strength of the Bud (each step by 20%) Bud(x) ==> Shoot(x) [ RU(30) Bud(0.8*x) ] [ RU(-30) Bud(0.8*x) ]; ]

branching, alternating position and shortening: Axiom ==> L(10) F0 A ; A ==> LMul(0.5) [ RU(90) F0 ] F0 RH(180) A ; in XL, A must be declared as module before: module A;

extension of the concept of symbol: allow real-valued parameters not only for turtle commands like " RU(45) " and " F(3) ", but for all characters  parametric L-systems arbitrarily long, finite lists of parameters parameters get values when the rule matches Example: rule A(x, y) ==> F(7*x+10) B(y/2) current symbol is e.g.: A(2, 6) after rule application: F(24) B(3) parameters can be checked in conditions (logical conditions with Java syntax): A(x, y) (x >= 17 && y != 0) ==>....

Test the examples sm09_e04.rgg two blocks of rules sm09_e05.rgg alternating phyllotaxis of branches

Suggestions for team session: Create the following simple branching patterns with XL