Skip to content

Commit 385ea8c

Browse files
committed
Update to VPL 0.0.7
1 parent cd531ef commit 385ea8c

13 files changed

Lines changed: 125 additions & 129 deletions

File tree

Project.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "VPLDocs"
22
uuid = "19246b20-85cd-4f94-a989-28bb6828320f"
33
authors = ["Alejandro Morales Sierra <alejandro.moralessierra@wur.nl> and contributors"]
4-
version = "0.0.6"
4+
version = "0.0.7"
55

66
[deps]
77
Ecophys = "19467474-d12d-47c9-939f-3e50fbfd93ad"
@@ -16,12 +16,12 @@ VirtualPlantLab = "b977ecfa-1b9a-418d-909d-4ebe565736ce"
1616

1717
[compat]
1818
Ecophys = "0.1.0"
19-
PlantGeomPrimitives = "0.0.3"
20-
PlantGeomTurtle = "0.0.4"
21-
PlantGraphs = "0.0.2"
22-
PlantRayTracer = "0.0.6"
19+
PlantGeomPrimitives = "0.0.5"
20+
PlantGeomTurtle = "0.0.6"
21+
PlantGraphs = "0.0.3"
22+
PlantRayTracer = "0.0.8"
2323
PlantSimEngine = "0.9"
24-
PlantViz = "0.0.6"
25-
SkyDomes = "0.1.6"
26-
VirtualPlantLab = "0.0.6"
27-
julia = "1.9"
24+
PlantViz = "0.0.8"
25+
SkyDomes = "0.1.8"
26+
VirtualPlantLab = "0.0.7"
27+
julia = "1.11"

docs/Project.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ VirtualPlantLab = "b977ecfa-1b9a-418d-909d-4ebe565736ce"
1313

1414
[compat]
1515
Ecophys = "0.1.0"
16-
PlantGeomPrimitives = "0.0.3"
17-
PlantGeomTurtle = "0.0.4"
18-
PlantGraphs = "0.0.2"
19-
PlantRayTracer = "0.0.6"
16+
PlantGeomPrimitives = "0.0.5"
17+
PlantGeomTurtle = "0.0.6"
18+
PlantGraphs = "0.0.3"
19+
PlantRayTracer = "0.0.8"
2020
PlantSimEngine = "0.9"
21-
PlantViz = "0.0.6"
22-
SkyDomes = "0.1.6"
23-
VirtualPlantLab = "0.0.6"
24-
julia = "1.9"
21+
PlantViz = "0.0.8"
22+
SkyDomes = "0.1.8"
23+
VirtualPlantLab = "0.0.7"
24+
julia = "1.11"

docs/src/howto/Coordinates.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ function simulate(n)
183183
for i in 1:n
184184
growth!(tree)
185185
end
186-
Scene(tree) # Generate the scene to trigger feed!() methods
186+
Mesh(tree) # Generate the mesh to trigger feed!() methods
187187
heights, angles = leaf_info(tree)
188188
return tree, heights, angles
189189
end
@@ -199,7 +199,7 @@ tree, heights, angles = simulate(25);
199199
We can check how the final tree looks like:
200200

201201
```julia
202-
render(Scene(tree))
202+
render(Mesh(tree))
203203
```
204204

205205
And we can plot the distribtuion of leaf heights and angles:
@@ -270,7 +270,7 @@ tree, heights2, angles2 = simulate(25);
270270
And confirm that we get the same tree:
271271

272272
```julia
273-
render(Scene(tree))
273+
render(Mesh(tree))
274274
length(angles) == length(angles2)
275275
```
276276

docs/src/howto/GridCloner.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,65 +89,65 @@ end
8989
tiles = vec([create_tile(origin, dx, dy) for origin in origins]);
9090
```
9191

92-
Now we can combine the plants and tiles into a single scene. We randomize the color of each
92+
Now we can combine the plants and tiles into a single mesh. We randomize the color of each
9393
tile to help identify them in the visualization:
9494

9595
```julia
96-
plant_scene = Scene(vec(plants));
97-
soil_scene = Scene()
96+
plant_mesh = Mesh(vec(plants));
97+
soil_mesh = Mesh()
9898
for tile in tiles
99-
add!(soil_scene, mesh = tile, colors = RGB(rand(), rand(), rand()))
99+
add!(soil_mesh, tile, colors = RGB(rand(), rand(), rand()))
100100
end
101-
scene = Scene([plant_scene, soil_scene]);
102-
render(scene)
101+
mesh = Mesh([plant_mesh, soil_mesh]);
102+
render(mesh)
103103
```
104104

105-
We can also visualize the bounding boxes of a scene (and any clone). If we just want the
106-
box for the original scene, we can create a grid with no clones. The build the acceleration
105+
We can also visualize the bounding boxes of a mesh (and any clone). If we just want the
106+
box for the original mesh, we can create a grid with no clones. The build the acceleration
107107
object (which includes the grid cloner) and add it to the 3D rendering:
108108

109109
```julia
110110
rt_settings = RTSettings(nx = 0, ny = 0)
111-
acc_one = accelerate(scene, settings = rt_settings);
112-
render(scene)
111+
acc_one = accelerate(mesh, settings = rt_settings);
112+
render(mesh)
113113
render!(acc_one.grid)
114114
```
115115

116116
We can see that bounding box extends to the tips of the leaves, as they grow beyond the soil
117-
area allocated to the plant. If we now create multiple clones of this scene, we should
117+
area allocated to the plant. If we now create multiple clones of this mesh, we should
118118
displace them by a distance of `10dx` along the x-axis and `10dy` along the y-axis. This
119119
will ensure that the soil tiles of clones do not overlap but the plants will. In other words,
120120
we emulate additional rows and plants within rows while respecting the same spacing between
121121
them:
122122

123123
```julia
124124
rt_settings = RTSettings(nx = 1, ny = 1, dx = 10dx, dy = 10dy)
125-
acc = accelerate(scene, settings = rt_settings);
125+
acc = accelerate(mesh, settings = rt_settings);
126126
```
127127

128-
We can now add all the bounding boxes of the clones to the scene:
128+
We can now add all the bounding boxes of the clones to the mesh:
129129

130130
```julia
131-
render(scene)
131+
render(mesh)
132132
render!(acc.grid)
133133
```
134134

135135
We can see that the bounding boxes of the clones overlap, as expected. Currently there is no
136136
way in VPL to visualize the actual clones (since that additional geometry is never actually
137137
generated, see details about *instancing* above). We can do this manually by manually changing
138-
the meshes of the scene using the method `VirtualPlantLab.translate!`. We add the bounding
139-
box of the original scene too:
138+
the meshes of the mesh using the method `VirtualPlantLab.translate!`. We add the bounding
139+
box of the original mesh too:
140140

141141
```julia
142-
scenes = Scene[]
142+
meshes = Mesh[]
143143
for i in -10:10
144144
for j in -10:10
145-
new_scene = deepcopy(scene)
146-
VirtualPlantLab.translate!(new_scene.mesh, Vec(i*10dx, j*10dy, 0.0))
147-
push!(scenes, new_scene)
145+
new_mesh = deepcopy(mesh)
146+
VirtualPlantLab.translate!(new_mesh, Vec(i*10dx, j*10dy, 0.0))
147+
push!(meshes, new_mesh)
148148
end
149149
end
150-
render(Scene(scenes), axes = false)
150+
render(Mesh(meshes), axes = false)
151151
render!(acc_one.grid, alpha = 0.8)
152152
```
153153

docs/src/howto/LightSources.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,31 +132,31 @@ creating multiple sensors below the light source and measuring the light intensi
132132
sensor.
133133

134134
```julia
135-
scene = Scene()
135+
mesh = Mesh()
136136
sensors = [Sensor(1) for _ in 1:400]
137137
c = 1
138138
for i in 1:20
139139
for j in 1:20
140140
r = Rectangle(length = 0.05, width = 0.05)
141141
rotatey!(r, π/2) ## To put it in the XY plane
142142
VirtualPlantLab.translate!(r, Vec((i - 1)*0.05, (j - 1)*0.05 + 0.025, 0.0))
143-
add!(scene, mesh = r, materials = sensors[c], colors = rand(RGB))
143+
add!(mesh, r, materials = sensors[c], colors = rand(RGB))
144144
c += 1
145145
end
146146
end
147147
```
148148

149149
```julia
150150
import GLMakie
151-
render(scene)
151+
render(mesh)
152152
```
153153

154154
We can now create a ray tracing object without a grid cloner (note that since all the
155155
surfaces are sensors we can just set `maxiter = 1`):
156156

157157
```julia
158158
settings = RTSettings(pkill = 0.9, maxiter = 1, parallel = true)
159-
rtobj = RayTracer(scene, source, settings = settings);
159+
rtobj = RayTracer(mesh, source, settings = settings);
160160
trace!(rtobj)
161161
```
162162

@@ -185,7 +185,7 @@ Let's test this by creating a new light source and tracing the rays again.
185185
```julia
186186
source = Source(PointSource(Vec(0.5, 0.5, 1.0)), GaussianSource(X(), Y(), -Z(), 1.0), 1.0, 1_000_000)
187187
settings = RTSettings(pkill = 0.9, maxiter = 1, parallel = true)
188-
rtobj = RayTracer(scene, source, settings = settings);
188+
rtobj = RayTracer(mesh, source, settings = settings);
189189
trace!(rtobj)
190190
```
191191

docs/src/howto/Materials.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ the calculations of absorbed irradiance.
6565

6666
```julia
6767
g = Graph(axiom = RA(90.0) + Tile(1.0, 1.0, 40));
68-
sc = Scene(g);
68+
sc = Mesh(g);
6969
source = DirectionalSource(sc, θ = π/4, Φ = π/2, radiosity = 1.0, nrays = 5_000_000);
7070
nothing #hide
7171
```
@@ -97,11 +97,10 @@ renderer to get the exact colors we specify.
9797

9898
```julia
9999
tile.colors = RGB.(0.0, α, 0.0)
100-
sc = Scene(g)
100+
sc = Mesh(g)
101101
render(sc, wireframe = true, shading = GLMakie.NoShading)
102102
```
103103

104104
---
105105

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

docs/src/howto/Message.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,20 @@ For a visualization of both leaves and internodes we can actually leave the mess
158158
given how the code above is structured:
159159

160160
```julia
161-
scene = Scene(newtree);
162-
render(scene, axes = false)
161+
mesh = Mesh(newtree);
162+
render(mesh, axes = false)
163163
```
164164

165165
For only leaves:
166166

167167
````julia
168-
scene = Scene(newtree, message = "leaves");
169-
render(scene, axes = false)
168+
mesh = Mesh(newtree, message = "leaves");
169+
render(mesh, axes = false)
170170
````
171171

172172
And for only internodes:
173173

174174
````julia
175-
scene = Scene(newtree, message = "internodes");
176-
render(scene, axes = false)
175+
mesh = Mesh(newtree, message = "internodes");
176+
render(mesh, axes = false)
177177
````

0 commit comments

Comments
 (0)