tutorials:simple-tomato-model
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| tutorials:simple-tomato-model [2024/12/06 01:30] – [Improving leaflet shape] ksmolen | tutorials:simple-tomato-model [2024/12/07 16:02] (current) – [A simple tomato plant model] ksmolen | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== A simple tomato plant model ====== | ====== A simple tomato plant model ====== | ||
| - | In this tutorial we will create a simple model of architecture and development | + | In this tutorial we will create a simple model of a tomato plant architecture. |
| + | |||
| + | ===== Preliminary steps ===== | ||
| + | |||
| + | We start a new project by opening a new RGG template model (File -> New -> RGG Project). | ||
| + | |||
| + | The simple model that we are going to create will have the following structure: | ||
| + | |||
| + | <code java> | ||
| + | |||
| + | // modules | ||
| + | |||
| + | // parameters | ||
| + | |||
| + | protected void init() | ||
| + | [ | ||
| + | Axiom ==> | ||
| + | // initial structure | ||
| + | ; | ||
| + | ] | ||
| + | |||
| + | public void run() | ||
| + | [ | ||
| + | // rewriting rule | ||
| + | ] | ||
| + | |||
| + | </ | ||
| ===== Organs ===== | ===== Organs ===== | ||
| Line 50: | Line 77: | ||
| ==== Specifying organ geometry ==== | ==== Specifying organ geometry ==== | ||
| - | The geometry of organs will be specified using instantiation rules '' | + | We extend the modules' |
| An '' | An '' | ||
| Line 118: | Line 145: | ||
| module Truss extends Organ | module Truss extends Organ | ||
| { | { | ||
| - | length = TRUSS_LENGTH; | + | |
| } | } | ||
| ==> | ==> | ||
| Line 172: | Line 199: | ||
| </ | </ | ||
| - | By applying | + | The turtle command '' |
| + | |||
| + | Now that we have specified the '' | ||
| + | |||
| + | By applying | ||
| In tomato, after a certain number of phytomers (internodes with leaves), specified by a parameter '' | In tomato, after a certain number of phytomers (internodes with leaves), specified by a parameter '' | ||
| - | We first specify a new parameter for the number of phytomers in a primary shoot: | + | We first specify a new parameter for the number of phytomers in primary shoot: |
| <code java> | <code java> | ||
| Line 251: | Line 282: | ||
| For an example on how to generate a leaflet mesh, see the tutorial [[: | For an example on how to generate a leaflet mesh, see the tutorial [[: | ||
| + | |||
| + | We use the code from the leaf triangulation tutorial to create a leaflet mesh '' | ||
| + | |||
| + | To use the leaflet mesh in our tomato model, we create a new module for leaflet: | ||
| + | |||
| + | <code java> | ||
| + | module Leaflet(double length) | ||
| + | ==> | ||
| + | RL(90) Scale(length, | ||
| + | ; | ||
| + | </ | ||
| + | |||
| + | Then we replace '' | ||
| + | |||
| + | |||
| + | {{ : | ||
| + | |||
| + | <code java> | ||
| + | module Leaf extends Organ | ||
| + | { | ||
| + | ... | ||
| + | } | ||
| + | ==> | ||
| + | ... | ||
| + | | ||
| + | // leaflet pairs | ||
| + | for (int i: | ||
| + | [RU(-80) RL(-30) Cylinder(0.04, | ||
| + | [RU( 80) RL(-30) Cylinder(0.04, | ||
| + | RL(20) | ||
| + | Cylinder(segmentLength, | ||
| + | ) | ||
| + | // terminal leaflet | ||
| + | Leaflet(segmentLength) | ||
| + | ; | ||
| + | </ | ||
| + | |||
tutorials/simple-tomato-model.1733445057.txt.gz · Last modified: 2024/12/06 01:30 by ksmolen
