Skip to content

Commit 95bc999

Browse files
committed
Update API of tutorials
1 parent b601132 commit 95bc999

5 files changed

Lines changed: 19 additions & 24 deletions

File tree

docs/src/tutorials/from_tree_forest/forest.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Alejandro Morales and Ana Ernst
55
Centre for Crop Systems Analysis - Wageningen University
66

77
> ## TL;DR
8-
> Similar in functionality to [Tree](https://virtualplantlab.com/dev/tutorials/from_tree_forest/tree/) tutorial with separate graphs for each tree
8+
> Similar in functionality to [Tree](https://virtualplantlab.com/dev/tutorials/from_tree_forest/tree/) tutorial with separate graphs for each tree
99
> - Modify tree parameters for each tree
1010
> - Multithreaded simulation (grow trees in parallel)
1111
> - Scene customization (e.g., add soil)
@@ -61,7 +61,7 @@ function VirtualPlantLab.feed!(turtle::Turtle, i::TreeTypes.Internode, data)
6161
# Rotate turtle around the head to implement elliptical phyllotaxis
6262
rh!(turtle, data.phyllotaxis)
6363
HollowCylinder!(turtle, length = i.length, height = i.length/15, width = i.length/15,
64-
move = true, color = RGB(0.5,0.4,0.0))
64+
move = true, colors = RGB(0.5,0.4,0.0))
6565
return nothing
6666
end
6767
````
@@ -74,7 +74,7 @@ function VirtualPlantLab.feed!(turtle::Turtle, l::TreeTypes.Leaf, data)
7474
ra!(turtle, -data.leaf_angle)
7575
# Generate the leaf
7676
Ellipse!(turtle, length = l.length, width = l.width, move = false,
77-
color = RGB(0.2,0.6,0.2))
77+
colors = RGB(0.2,0.6,0.2))
7878
# Rotate turtle back to original direction
7979
ra!(turtle, data.leaf_angle)
8080
return nothing
@@ -293,7 +293,7 @@ VirtualPlantLab.translate!(soil, Vec(0.0, 10.5, 0.0))
293293
We can now add the `soil` to the `scene` object with the `add!` function.
294294

295295
````julia
296-
VirtualPlantLab.add!(scene, mesh = soil, color = RGB(1,1,0))
296+
VirtualPlantLab.add!(scene, mesh = soil, colors = RGB(1,1,0))
297297
````
298298

299299
We can now render the scene that combines the random forest of binary trees and a yellow soil. Notice that
@@ -321,4 +321,3 @@ export_scene(scene = output, filename = "nice_trees.png")
321321
---
322322

323323
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
324-

docs/src/tutorials/from_tree_forest/growthforest.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ Centre for Crop Systems Analysis - Wageningen University
88
> Now we want to implement a more extended functionality of our [Forest]()!
99
> - Growth rules, based on information stored in organs (dimensions, carbon assimilation)
1010
> - Update dimensions in function of assimilation
11-
> - Compute sink strength
11+
> - Compute sink strength
1212
> - Merge Scenes
1313
> - Generate forest on grid and retrieve canopy-level data (e.g., LAI)
14-
>
14+
>
1515
1616
In this example we extend the binary forest example to have more complex, time-
1717
dependent development and growth based on carbon allocation. For simplicity, the
@@ -111,7 +111,7 @@ function VirtualPlantLab.feed!(turtle::Turtle, i::TreeTypes.Internode, vars)
111111
# Rotate turtle around the head to implement elliptical phyllotaxis
112112
rh!(turtle, vars.phyllotaxis)
113113
HollowCylinder!(turtle, length = i.length, height = i.width, width = i.width,
114-
move = true, color = RGB(0.5,0.4,0.0))
114+
move = true, colors = RGB(0.5,0.4,0.0))
115115
return nothing
116116
end
117117

@@ -121,7 +121,7 @@ function VirtualPlantLab.feed!(turtle::Turtle, l::TreeTypes.Leaf, vars)
121121
ra!(turtle, -vars.leaf_angle)
122122
# Generate the leaf
123123
Ellipse!(turtle, length = l.length, width = l.width, move = false,
124-
color = RGB(0.2,0.6,0.2))
124+
colors = RGB(0.2,0.6,0.2))
125125
# Rotate turtle back to original direction
126126
ra!(turtle, vars.leaf_angle)
127127
return nothing
@@ -400,7 +400,7 @@ Base.@kwdef struct Soil <: VirtualPlantLab.Node
400400
width::Float64
401401
end
402402
function VirtualPlantLab.feed!(turtle::Turtle, s::Soil, vars)
403-
Rectangle!(turtle, length = s.length, width = s.width, color = RGB(255/255, 236/255, 179/255))
403+
Rectangle!(turtle, length = s.length, width = s.width, colors = RGB(255/255, 236/255, 179/255))
404404
end
405405
soil_graph = RA(-90.0) + T(Vec(0.0, 10.0, 0.0)) + # Moves into position
406406
Soil(length = 20.0, width = 20.0) # Draws the soil tile
@@ -459,4 +459,3 @@ get_LAI(forest)
459459
---
460460

461461
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
462-

docs/src/tutorials/from_tree_forest/raytracedforest.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Centre for Crop Systems Analysis - Wageningen University
1010
> - Create sky for specific conditions and locations using [SkyDomes](https://virtualplantlab.com/dev/VPLVerse/SkyDomes/)
1111
> - Layer different types of radiation in sky domes (e.g., direct and diffuse)
1212
> - Combine graph and sky with a ray-tracer
13-
> - Compute growth and biomass production according to PAR interception and RUE
14-
>
13+
> - Compute growth and biomass production according to PAR interception and RUE
14+
>
1515
1616
In this example we extend the [Growth Forest](https://virtualplantlab.com/dev/tutorials/from_tree_forest/growthforest/) model to include PAR interception and radiation use efficiency to compute the daily growth rate.
1717

@@ -107,7 +107,7 @@ function VirtualPlantLab.feed!(turtle::Turtle, i::TreeTypes.Internode, data)
107107
# Rotate turtle around the head to implement elliptical phyllotaxis
108108
rh!(turtle, data.phyllotaxis)
109109
HollowCylinder!(turtle, length = i.length, height = i.width, width = i.width,
110-
move = true, color = RGB(0.5,0.4,0.0), material = i.material)
110+
move = true, colors = RGB(0.5,0.4,0.0), materials = i.material)
111111
return nothing
112112
end
113113

@@ -117,7 +117,7 @@ function VirtualPlantLab.feed!(turtle::Turtle, l::TreeTypes.Leaf, data)
117117
ra!(turtle, -data.leaf_angle)
118118
# Generate the leaf
119119
Ellipse!(turtle, length = l.length, width = l.width, move = false,
120-
color = RGB(0.2,0.6,0.2), material = l.material)
120+
colors = RGB(0.2,0.6,0.2), materials = l.material)
121121
# Rotate turtle back to original direction
122122
ra!(turtle, data.leaf_angle)
123123
return nothing
@@ -227,7 +227,7 @@ function create_scene(forest)
227227
# Add a soil surface
228228
soil = create_soil()
229229
soil_material = Lambertian= 0.0, ρ = 0.21)
230-
add!(scene, mesh = soil, material = soil_material)
230+
add!(scene, mesh = soil, materials = soil_material)
231231
# Return the scene
232232
return scene
233233
end
@@ -558,7 +558,7 @@ Base.@kwdef struct Soil <: VirtualPlantLab.Node
558558
width::Float64
559559
end
560560
function VirtualPlantLab.feed!(turtle::Turtle, s::Soil, data)
561-
Rectangle!(turtle, length = s.length, width = s.width, color = RGB(255/255, 236/255, 179/255))
561+
Rectangle!(turtle, length = s.length, width = s.width, colors = RGB(255/255, 236/255, 179/255))
562562
end
563563
soil_graph = RA(-90.0) + T(Vec(0.0, 10.0, 0.0)) + ## Moves into position
564564
Soil(length = 20.0, width = 20.0) ## Draws the soil tile
@@ -598,4 +598,3 @@ end
598598
---
599599

600600
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
601-

docs/src/tutorials/from_tree_forest/tree.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function VirtualPlantLab.feed!(turtle::Turtle, i::TreeTypes.Internode, vars)
7373
# Rotate turtle around the head to implement elliptical phyllotaxis
7474
rh!(turtle, vars.phyllotaxis)
7575
HollowCylinder!(turtle, length = i.length, height = i.length/15, width = i.length/15,
76-
move = true, color = RGB(0.5,0.4,0.0))
76+
move = true, colors = RGB(0.5,0.4,0.0))
7777
return nothing
7878
end
7979

@@ -83,7 +83,7 @@ function VirtualPlantLab.feed!(turtle::Turtle, l::TreeTypes.Leaf, vars)
8383
ra!(turtle, -vars.leaf_angle)
8484
# Generate the leaf
8585
Ellipse!(turtle, length = l.length, width = l.width, move = false,
86-
color = RGB(0.2,0.6,0.2))
86+
colors = RGB(0.2,0.6,0.2))
8787
# Rotate turtle back to original direction
8888
ra!(turtle, vars.leaf_angle)
8989
return nothing
@@ -202,4 +202,3 @@ render(Scene(newtree))
202202
---
203203

204204
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
205-

docs/src/tutorials/getting_started/snowflakes.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Centre for Crop Systems Analysis - Wageningen University
77
> ### TL;DR
88
> - Define parameter for graph nodes
99
> - Define methods for VirtualPlantLab.feed! functions
10-
> - Create [Scenes](https://virtualplantlab.com/dev/manual/Geometry/Turtle/#Scenes)
10+
> - Create [Scenes](https://virtualplantlab.com/dev/manual/Geometry/Turtle/#Scenes)
1111
> - [Visualization](https://virtualplantlab.com/dev/manual/Visualization/) of 'Graph' with render()
1212
>
1313
@@ -118,7 +118,7 @@ to generate random colors.
118118
function VirtualPlantLab.feed!(turtle::Turtle, e::sn.E, vars)
119119
HollowCylinder!(turtle, length = e.length, width = e.length/10,
120120
height = e.length/10, move = true,
121-
color = RGB(rand(), rand(), rand()))
121+
colors = RGB(rand(), rand(), rand()))
122122
return nothing
123123
end
124124
````
@@ -215,4 +215,3 @@ render(Scene(Cesaro), axes = false)
215215
---
216216

217217
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
218-

0 commit comments

Comments
 (0)