Teaching Aid

Query (2) / ancestor

 

 
Copy/Paste the following code to your GroIMP project:
//**********************************************************
/*
You will learn:
– to use a query with the relation -ancestor->.
– take care of the edge direction!
*/

module B extends Sphere(0.1)
{{setShader(GREEN);}};

// the nodes of types A and S will not be drawn:
module A;
module S;

protected void init()
[
Axiom ==> A P(1) D(0.5) F(10) [ S RU(30) B ] B;
]

public void runA()
[

// rule 1: applicable to all B which have an A node as predecessor
// (possibly with skipping intermediate nodes).
// Arbitrarily many < and <+ edges can be skipped.

B (* -ancestor-> A *) ==> F(10) [ S RU(30) B ] B;
]

public void runS()
[

// rule 2: applicable to all B which have an S node als predecessor
// (possibly with skipping intermediate nodes).
// Arbitrarily many < edges can be skipped.

B (* (<)* S *) ==> F(10) B;
]

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

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.