tutorials:radiation-model-in-crop_model4
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorials:radiation-model-in-crop_model4 [2025/05/27 16:51] – created barley1965 | tutorials:radiation-model-in-crop_model4 [2025/05/27 17:58] (current) – barley1965 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Introducing absorbing tiles ====== | ====== Introducing absorbing tiles ====== | ||
- | //Open Tiles.gsz.// | + | // |
We also want to visualize how much light is reaching the ground. To do that, we cover the soil surface around the plant with light-absorbing tiles. First of all, you need to declare a new module: | We also want to visualize how much light is reaching the ground. To do that, we cover the soil surface around the plant with light-absorbing tiles. First of all, you need to declare a new module: | ||
Line 13: | Line 13: | ||
</ | </ | ||
- | Note that we declare the variable al, which will be used to store the light absorbed by a tile, in a different way, namely not between parentheses but between curly braces and on a new line. We could have declared module Tile(float len, float wid, float al) …, and this would not have made a big difference. However, the method to declare variables in parentheses behind the name becomes increasingly cumbersome when we are dealing with many variables. Also, when we declare the variables in this new way, we can refer to them in a more straightforward way, for instance t:Tile ::> t[al]… and don’t need to worry about the position of the variable in the module declaration (as was the case in parametric L-systems). | + | Note that we declare the variable |
+ | <code java> | ||
+ | t:Tile ::> t[al]… | ||
+ | </ | ||
+ | and don’t need to worry about the position of the variable in the module declaration (as was the case in parametric L-systems). | ||
In the Axiom rule, preceding the Bud, we place 1600 (40 x 40) tiles (L. 84ff): | In the Axiom rule, preceding the Bud, we place 1600 (40 x 40) tiles (L. 84ff): | ||
- | + | <code java> | |
- | Like the leaves, the tiles will become brighter when they absorb light. Update is done in the absorbAndGrow() method: | + | Axiom ==> //insert light absorbing tiles here: |
- | + | [ | |
- | Task: Obtain the sum of light that is absorbed by the tiles and plot it! (Hint: you can simply add a column “1” to the existing data table and then extend the method updateChart() with the sum function). | + | RL(90) M(4) RU(90) M(-4) |
+ | for((1: | ||
+ | for((1: | ||
+ | Tile(0.25, | ||
+ | ) | ||
+ | M(-10) RU(90) M(0.25) RU(-90) | ||
+ | ) | ||
+ | ] | ||
+ | |||
+ | Bud(1, PHYLLOCHRON, | ||
+ | </ | ||
+ | |||
+ | Like the [[tutorials: | ||
+ | |||
+ | <code java> | ||
+ | // | ||
+ | t:Tile ::> { | ||
+ | t[al] = lm.getAbsorbedPower3d(t).integrate(); | ||
+ | // | ||
+ | t.(setShader(new AlgorithmSwitchShader( | ||
+ | new RGBAShader(t[al]*300, | ||
+ | new RGBAShader(0.6, | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | {{tutorials: | ||
+ | |||
+ | //Task: Obtain the sum of light that is absorbed by the tiles and plot it! (Hint: you can simply add a column “1” to the existing data table and then extend the method | ||
tutorials/radiation-model-in-crop_model4.1748357510.txt.gz · Last modified: 2025/05/27 16:51 by barley1965