Dragon Curve Drawn in Project 4… How to generate the string of drawing commands? How does the dragon curve come about? 1.

Slides:



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

Turtle Graphics Eric Roberts Nifty Assignments SIGCSE 2013 March 9, 2013 This is not your typical assignmentCeux ne sont pas vos devoirs typiques.
Tail Recursion. Problems with Recursion Recursion is generally favored over iteration in Scheme and many other languages – It’s elegant, minimal, can.
Loops, and sub-routines Interrupts Can be very useful in control applications particularly when the microprocessor must perform two tasks apparently.
JYC: CSM17 BioinformaticsCSM17 Week 8: Simulations (part 2): plant morphology sea shells (marine molluscs) fractals virtual reality –Lindenmayer systems.
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.
SCRIPTING AND CONSTRUCTION THREE DIMENSIONAL TREE By Ryan Pierce and Marco Rathjen.
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.
Recursion: Overview What is Recursion? Reasons to think recursively? An Example How does recursion work?
CS 310 – Fall 2006 Pacific University CS310 Parsing with Context Free Grammars Today’s reference: Compilers: Principles, Techniques, and Tools by: Aho,
CS39N The Beauty and Joy of Computing Lecture #11 Recursion III It has been a challenge to power electronic components implanted within a body.
Fractals Complex Adaptive Systems Professor Melanie Moses March
RECURSIVE PATTERNS WRITE A START VALUE… THEN WRITE THE PATTERN USING THE WORDS NOW AND NEXT: NEXT = NOW _________.
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.
Introduction to Programming End Show. Resource Team R.P Ranjan-Lecturer, SPICTEC, Galle. W.M.A.S. Wijesekara-Centre manager,CRC Hali-Ela H.P.U.S Indra.
2.2 A Simple Syntax-Directed Translator Syntax-Directed Translation 2.4 Parsing 2.5 A Translator for Simple Expressions 2.6 Lexical Analysis.
Log on and Download from website:
Modelling of Ecosystems by Tools from Computer Science Summer School at Czech University of Life Sciences, Prague, September, 2013 Winfried Kurth.
STRINGS CMSC 201 – Lab 3. Overview Objectives for today's lab:  Obtain experience using strings in Python, including looping over characters in strings.
Java Programming Introduction & Concepts. Introduction to Java Developed at Sun Microsystems by James Gosling in 1991 Object Oriented Free Compiled and.
Fall Week 3 CSCI-141 Scott C. Johnson.  Say we want to draw the following figure ◦ How would we go about doing this?
L-Systems and Procedural Plants CSE 3541 Matt Boggus.
Tao Ju, Ron Goldman Rice University
Different Varieties of Genetic Programming Je-Gun Joung.
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,
Python Programming Chapter 6: Iteration Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Examining the World of Fractals. Myles Akeem Singleton Central Illinois Chapter National BDPA Technology Conference 2006 Los-Angeles, CA.
What is Genetic Programming? Genetic programming is a model of programming which uses the ideas (and some of the terminology) of biological evolution to.
PART I: overview material
30/09/04 AIPP Lecture 3: Recursion, Structures, and Lists1 Recursion, Structures, and Lists Artificial Intelligence Programming in Prolog Lecturer: Tim.
L-Systems Lindenmayer Systems Prusinkiewicz and Lindenmayer
Summer School „Modelling and Simulation with GroIMP“ / Tutorial for beginners University of Göttingen (Germany), September, 2010 Winfried Kurth Some.
Lindenmayer systems Martijn van den Heuvel May 26th, May 26th, 2011.
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.
Lexical Analysis I Specifying Tokens Lecture 2 CS 4318/5531 Spring 2010 Apan Qasem Texas State University *some slides adopted from Cooper and Torczon.
Character Generation.
1 10/27/ :26 UML Simplicity in Complexity. 2 10/27/ :26 UML Rewriting Systems Classic Example: Koch 1905 Initiator Generator.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
LINDFERN Lindenmayer Systems in VPython Nick Langhammer.
Cellular Automata FRES 1010 Eileen Kraemer Fall 2005.
Loops Robin Burke IT 130. Outline Announcement: Homework #6 Conditionals (review) Iteration while loop while with counter for loops.
 Line of sight (LOS) is an imaginary line from the eye to the object. LOS for F.V. LOS for T.V.  To see the true shape of a surface, LOS must be perpendicular.
Seeing the forest for the trees. Training Lumberjacks.
ATEC Procedural Animation Introduction to Procedural Methods in 3D Computer Animation Dr. Midori Kitagawa.
Experimenting with Grammars to Generate L-Systems October 29, 2007
Saving TI-83 List Data to a Program File. Saving TI-83 Lists to a Program Step 1: Create a New Program Press PRGM and arrow over to NEW Press ENTER and.
Integration of simulation tools in online virtual worlds Stéphane SIKORA AI Lab of Paris5 University 2nd conference on.
Functional-Structural Plant Modelling with GroIMP and XL Tutorial and Workshop at Agrocampus Ouest, Angers, 5-7 May, 2015 Winfried Kurth University of.
Animation of Plant Development Presented by Rich Honhart Paper by Prusinkiewicz, Hammel, and Mjolness.
Machine Language Computer languages cannot be directly interpreted by the computer – they are not in binary. All commands need to be translated into binary.
Experimenting with Grammars to Generate L-Systems – in JFLAP March 31, 2011 Prof. Susan Rodger Computer Science Dept.
Dr. Hussien Sharaf Dr Emad Nabil. Dr. Hussien M. Sharaf 2 position := initial + rate * Lexical analyzer 2. Syntax analyzer id 1 := id 2 + id 3 *
Grammars, L-Systems Jim Whitehead UC Santa Cruz School of Engineering courses.soe.ucsc.edu/courses/cmps265/Spring14/01 23 Apr 2014.
Computer Programming.
ATCM 3310 Procedural Animation
Looping and Random Numbers
Important Concepts from Clojure
Important Concepts from Clojure
Factorial Recursion Runtime Stack
Saving TI-83 List Data to a Program File
Trees and Colored Edge Detection
Creating a Koch Curve Fractal
Important Concepts from Clojure
Presentation transcript:

Dragon Curve Drawn in Project 4… How to generate the string of drawing commands? How does the dragon curve come about? 1

Startup: 1 fold 2 R

2 nd Fold 3 R R R L

3 rd Fold 4 R R R L R R L R R L L

4 th Fold 5 R R R L R R L R R L L RRL R RLL R RRL L RLL

Patterns 6 R R R L R R L R R L L RRL R RLL R RRL L RLL R R R L L R L L

Patterns 7 R R R L R R L R R L L RRL R RLL R RRL L RLL R R R L L R L L R R R L R R L R R L L RRL R RLL R RRL L RLL

Patterns 8 R R R L R R L R R L L RRL R RLL R RRL L RLL R R R L L R L L R R R L R R L R R L L RRL R RLL R RRL L RLL T(f+1,R) = T(f,R)+R+T(f,L) T(f+1,L) = T(f,R)+L+T(f,L) T(1,R) = R T(1,L) = L

Resulting Code def dragon(fold, root): if fold == 1: return root return dragon(fold-1,'R')+root+dragon(fold-1,'L') 9 T(f+1,'R') = T(f,'R')+'R'+T(f,'L') T(f+1,'L') = T(f,'R')+'L'+T(f,'L')

RL → NSEW Done to simplify project 4 Conversion: Head north by one length Then execute the turn instructions writing the resulting heading Example: RRL 1. N 2. E 3. S 4. E So the result is NESE 10

Lindenmayer Systems How to model biological tree growth and plant architecture? Our trees are constructed node-by-node, serially Nature’s trees grow in parallel Parallel rewrite systems 11

Lindenmayer Systems Textually – the dragon curve does this: R => RRL R => R L => RLL L => L This is a parallel rewriting system 12 RRLRRLL => RRLRRLLRRRLLRLL

Simple Rewriting Loop 1. Start with a string w 2. Replace each character c in w with a string s(c) according to the rules stipulated 3. Repeat 13 R => RRL L => RLL R => R L => L R => RRL RRL => RRLRRLL RRLRRLL => RRLRRLLRRRLLRLL

Q: String length for n Folds is: 14 R => RRL L => RLL R => R L => L

Drawing the string Interpret each character in the string as doing some drawing operation, exactly as in Project 4 For the L-R string of the dragon curve: Make turn, draw a single line (fixed length) 15 R L

2 Parts Part 1: string rewriting system defined Need start string w Need substitution rules Part 2: string mapped to a drawing Some characters used to draw simple shape, perhaps a line Some characters used to change direction etc Some characters used to save and restore state (recursively) 16

L-Systems Rewrite + drawing rules yield models of biological shapes and growth Some examples from the web that mention Prusinkievicz 17

Worked Example Characters: F + - [ ] Initial string: F Rewrite rule: F → F [ - F ] F [ + F ] [ F ] See online/e28_3/lsys.htmlhttp:// online/e28_3/lsys.html 18

Generations 1 and 2 19 F [ - F ] F [ + F ] [ F ] F[-F]F[+F][F][-F[-F]F[+F][F]]F[-F]F[+F][F][+F[-F]F[+F][F]][F[-F]F[+F][F]]

How to draw 20

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

How to draw F [ - F ] F [ + F ] [ F ]

Running this System Generations 2 to 5 33