workshops:sdau_course
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| workshops:sdau_course [2025/11/12 12:18] – ksmolen | workshops:sdau_course [2025/11/14 11:42] (current) – ksmolen | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | **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 [[https:// | ||
| + | |||
| + | To add the leaf shape function into the model, open the '' | ||
| + | |||
| + | <code java> | ||
| + | module Leaflet(float length, double width) | ||
| + | { | ||
| + | } ==> | ||
| + | [ | ||
| + | { | ||
| + | int segments = 100; | ||
| + | } | ||
| + | |||
| + | for (double i=1; i < segments; i++) | ||
| + | ( | ||
| + | { | ||
| + | double segmentLength; | ||
| + | segmentLength = length/ | ||
| + | // getNormalizedLeafWidth specifies the half of the shape | ||
| + | double segmentWidth = 0.5*width * getNormalizedLeafWidth(1 - i/ | ||
| + | } | ||
| + | |||
| + | Parallelogram(segmentLength, | ||
| + | | ||
| + | RL(60.0/ | ||
| + | ) | ||
| + | ]; | ||
| + | |||
| + | // calculate leaf shape as the normalized width along the midrib, | ||
| + | // full model: Coussement et al. 2018 | ||
| + | // https:// | ||
| + | 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)/ | ||
| + | } else { | ||
| + | gL = 1 - Math.pow((lnorm - maxWidth)/ | ||
| + | } | ||
| + | |||
| + | return gL; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | Then, inside the definition of '' | ||
| + | |||
| + | Updated model: | ||
| + | * {{ : | ||
| + | |||
| **Modelling with L-systems.** | **Modelling with L-systems.** | ||
| Line 6: | Line 64: | ||
| Model example: | Model example: | ||
| * {{ : | * {{ : | ||
| + | * {{ : | ||
| Line 18: | Line 77: | ||
| * {{ : | * {{ : | ||
| - | Simple tomato crop model. | + | **Simple tomato crop model.** |
| Model example: | Model example: | ||
workshops/sdau_course.1762946337.txt.gz · Last modified: 2025/11/12 12:18 by ksmolen
