User Tools

Site Tools


tutorials:simple-tomato-model

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorials:simple-tomato-model [2024/12/07 15:30] – [Improving leaflet shape] ksmolentutorials: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 of a tomato plant.+In this tutorial we will create a simple model of a tomato plant architecture.
  
 ===== Preliminary steps ===== ===== Preliminary steps =====
Line 199: Line 199:
 </code> </code>
  
 +The turtle command ''RH'' is used to create the phyllotactic pattern of leaves (resulting in their placement around the stem). 
 + 
 Now that we have specified the ''Axiom'' inside the ''init()'' method and a rewriting rule for the ''Apex'' inside the ''run()'' method, we can run the model by clicking on the ''run'' button in the RGG Toolbar, placed above the 3D View. Now that we have specified the ''Axiom'' inside the ''init()'' method and a rewriting rule for the ''Apex'' inside the ''run()'' method, we can run the model by clicking on the ''run'' button in the RGG Toolbar, placed above the 3D View.
  
-By applying this rule to an apex 7 times, we create a small plant made of 7 internodes and 7 leaves.+By applying the above rule to an apex 7 times, we create a small plant made of 7 internodes and 7 leaves.
  
 In tomato, after a certain number of phytomers (internodes with leaves), specified by a parameter ''NB_VEG_PHYTOMERS'', primary shoot turns into a sympodial shoot, that bears trusses with fruits. For this sympodial shoot, a repetitive pattern with 3 leaves and 1 truss with fruits is typical in many (high-wire) tomato cultivars. In tomato, after a certain number of phytomers (internodes with leaves), specified by a parameter ''NB_VEG_PHYTOMERS'', primary shoot turns into a sympodial shoot, that bears trusses with fruits. For this sympodial shoot, a repetitive pattern with 3 leaves and 1 truss with fruits is typical in many (high-wire) tomato cultivars.
Line 280: Line 282:
  
 For an example on how to generate a leaflet mesh, see the tutorial [[:Tutorials:leaf-triangulation| Leaf triangulation ]]. For an example on how to generate a leaflet mesh, see the tutorial [[:Tutorials:leaf-triangulation| Leaf triangulation ]].
 +
 +We use the code from the leaf triangulation tutorial to create a leaflet mesh ''MeshNode.(setPolygons(polygonMesh))'', where the polygons (''polygonMesh'') are created from a list of predefined vertices (''vertexDataLeaflet'').
 +
 +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, length, 0.01) MeshNode.(setPolygons(polygonMesh), setShader(GREEN))
 +;
 +</code> 
 +
 +Then we replace ''Parallelogram''-s in the Leaf module by the newly defined ''Leaflet''-s:
 +
  
 {{ :tutorials:simpletomatoleafletsmesh_crop.png?150|}} {{ :tutorials:simpletomatoleafletsmesh_crop.png?150|}}
 +
 +<code java>
 +module Leaf extends Organ 
 +{
 +    ...
 +}
 +==> 
 +    ...
 +    
 +    // leaflet pairs
 +    for (int i:1:NB_LEAFLET_PAIRS) (
 +        [RU(-80) RL(-30) Cylinder(0.04, 0.003) RL(40) Leaflet(0.1)]
 +        [RU( 80) RL(-30) Cylinder(0.04, 0.003) RL(40) Leaflet(0.1)]
 +        RL(20)
 +        Cylinder(segmentLength, 0.003)
 +    )
 +    // terminal leaflet
 +    Leaflet(segmentLength)
 +;
 +</code>
 +
  
    
tutorials/simple-tomato-model.1733581810.txt.gz · Last modified: 2024/12/07 15:30 by ksmolen