Improving leaf shape in the simple tomato model

For improved leaf shape, we can define the leaf contour using a mathematical model. Below is the implementation of a simplified version; for the full equation, see Coussement et al. (2018).

To add the leaf shape function into the model, open the simple_tomato_growth_sdau.gsz example and copy the code below inside the modules_organs.rgg file.

module Leaflet(float length, double width)
{	
} ==> 
[
    { 
        int segments = 100; 
    } 
 
    for (double i=1; i < segments; i++)
    (
        {
            double segmentLength;
            segmentLength = length/segments;
            // getNormalizedLeafWidth specifies the half of the shape
            double segmentWidth = 0.5*width * getNormalizedLeafWidth(1 - i/segments);
        }
 
        Parallelogram(segmentLength, 2*segmentWidth).(setShader(GREEN))
 
        RL(60.0/segments)
    )
];
 
// calculate leaf shape as the normalized width along the midrib, 
// full model: Coussement et al. 2018
// https://doi.org/10.14214/sf.7740
static double getNormalizedLeafWidth(float lnorm) {
 
    double k1 = 2;
    double k2 = 2.2;
 
    double gL = 0;
 
    double maxWidth = 0.6;
 
    if (lnorm <= maxWidth) {
        gL = 1 - Math.pow((maxWidth - lnorm)/maxWidth,k1);	
        } else {
            gL = 1 - Math.pow((lnorm - maxWidth)/(1 - maxWidth),k2);
        }
 
        return gL;
    }

Then, inside the definition of module Leaf, replace every occurrence of Parallelogram by Leaflet.

Updated model:

Modelling with L-systems.

Slides:

Model example:

Simple models of development.

Slides:

Simple development model demonstrating the use of different type of rules.

Model example:

Simple tomato crop model.

Model example:

Optional:

How to construct a simple tomato architecture model.

Tutorial: A simple tomato plant model

Model examples: