@@ -10,27 +10,27 @@ requires using the Distributions.jl package:
1010The data types, rendering methods and growth rules are the same as in the binary
1111tree example:
1212=#
13- using VPL
13+ using VirtualPlantLab
1414using Distributions, ColorTypes
1515import GLMakie
1616import Base. Threads: @threads
1717# Data types
1818module TreeTypes
19- import VPL
19+ import VirtualPlantLab
2020# Meristem
21- struct Meristem <: VPL .Node end
21+ struct Meristem <: VirtualPlantLab .Node end
2222# Bud
23- struct Bud <: VPL .Node end
23+ struct Bud <: VirtualPlantLab .Node end
2424# Node
25- struct Node <: VPL .Node end
25+ struct Node <: VirtualPlantLab .Node end
2626# BudNode
27- struct BudNode <: VPL .Node end
27+ struct BudNode <: VirtualPlantLab .Node end
2828# Internode (needs to be mutable to allow for changes over time)
29- Base. @kwdef mutable struct Internode <: VPL .Node
29+ Base. @kwdef mutable struct Internode <: VirtualPlantLab .Node
3030 length:: Float64 = 0.10 # Internodes start at 10 cm
3131end
3232# Leaf
33- Base. @kwdef struct Leaf <: VPL .Node
33+ Base. @kwdef struct Leaf <: VirtualPlantLab .Node
3434 length:: Float64 = 0.20 # Leaves are 20 cm long
3535 width:: Float64 = 0.1 # Leaves are 10 cm wide
3636end
@@ -48,7 +48,7 @@ import .TreeTypes
4848
4949let
5050 # Create geometry + color for the internodes
51- function VPL . feed! (turtle:: Turtle , i:: TreeTypes.Internode , data)
51+ function VirtualPlantLab . feed! (turtle:: Turtle , i:: TreeTypes.Internode , data)
5252 # Rotate turtle around the head to implement elliptical phyllotaxis
5353 rh! (turtle, data. phyllotaxis)
5454 HollowCylinder! (
6363 end
6464
6565 # Create geometry + color for the leaves
66- function VPL . feed! (turtle:: Turtle , l:: TreeTypes.Leaf , data)
66+ function VirtualPlantLab . feed! (turtle:: Turtle , l:: TreeTypes.Leaf , data)
6767 # Rotate turtle around the arm for insertion angle
6868 ra! (turtle, - data. leaf_angle)
6969 # Generate the leaf
8080 end
8181
8282 # Insertion angle for the bud nodes
83- function VPL . feed! (turtle:: Turtle , b:: TreeTypes.BudNode , data)
83+ function VirtualPlantLab . feed! (turtle:: Turtle , b:: TreeTypes.BudNode , data)
8484 # Rotate turtle around the arm for insertion angle
8585 ra! (turtle, - data. branch_angle)
8686 end
101101 node = parent (bud)
102102 # We count the number of internodes between node and the first Meristem
103103 # moving down the graph
104- check, steps = hasdescendant (node, condition = n -> data (n) isa TreeTypes. Meristem)
104+ check, steps = has_descendant (node, condition = n -> data (n) isa TreeTypes. Meristem)
105105 steps = Int (ceil (steps / 2 )) # Because it will count both the nodes and the internodes
106106 # Compute probability of bud break and determine whether it happens
107107 if check
@@ -282,20 +282,20 @@ let
282282 simplest approach is two use a special constructor `Rectangle` where one species
283283 a corner of the rectangle and two vectors defining the two sides of the vectors.
284284 Both the sides and the corner need to be specified with `Vec` just like in the
285- above when we determined the origin of each plant. VPL offers some shortcuts:
285+ above when we determined the origin of each plant. VirtualPlantLab offers some shortcuts:
286286 `O()` returns the origin (`Vec(0.0, 0.0, 0.0)`), whereas `X`, `Y` and `Z`
287287 returns the corresponding axes and you can scale them by passing the desired
288288 length as input. Below, a rectangle is created on the XY plane with the origin
289289 as a corner and each side being 11 units long:
290290 =#
291291 soil = Rectangle (length = 21.0 , width = 21.0 )
292292 rotatey! (soil, pi / 2 )
293- VPL . translate! (soil, Vec (0.0 , 10.5 , 0.0 ))
293+ VirtualPlantLab . translate! (soil, Vec (0.0 , 10.5 , 0.0 ))
294294
295295 #=
296296 We can now add the `soil` to the `scene` object with the `add!` function.
297297 =#
298- VPL . add! (scene, mesh = soil, color = RGB (1 , 1 , 0 ))
298+ VirtualPlantLab . add! (scene, mesh = soil, color = RGB (1 , 1 , 0 ))
299299
300300 #=
301301 We can now render the scene that combines the random forest of binary trees and
0 commit comments