Teaching Aid

Instantiation rules

 

 
Copy/Paste the following code to your GroIMP project:
//**********************************************************
/* You will learn:
Two possible uses of instantiation rules.
– for the more exact design of an object immediately preceding
its graphical representation (similar to interpretive rules),
– for “copying” and controlled placement of the copies of
complex objects with particular, defined replicator objects.
*/

const int multiply = EDGE_0;

module Tree ==> F(20, 1)
[ M(-8) RU(45) F(6, 0.8) Sphere(1) ]
[ M(-5) RU(-45) F(4, 0.6) Sphere(1) ] Sphere(2);

module Replicator ==> [ getFirst(multiply) ] Translate(10, 0, 0)
[ getFirst(multiply) ];

public void run1()
[
Axiom ==> F(2, 6) P(10) Tree;
]

public void run2()
[
Axiom ==> F(2, 6) P(10) Replicator -multiply-> Tree;
]

//**********************************************************
 

DATE: 2009

 

AUTHOR: W. Kurth

 

DESCRIPTION:  see model

 

Welcome to the website grogra.de. This site is the web centre of growth grammars of the Department Ecoinformatics, Biometrics and Forest Growth at the Georg-August University of Göttingen and its cooperation partners.