@@ -206,14 +206,14 @@ end
206206
207207As growth is now dependent on intercepted PAR via RUE, we now need to simulate
208208light interception by the trees. We will use a ray-tracing approach to do so.
209- The first step is to create a scene with the trees and the light sources. As for
210- rendering, the scene can be created from the `forest` object by simply calling
211- `Scene (forest)` that will generate the 3D meshes and connect them to their
209+ The first step is to create a mesh with the trees and the light sources. As for
210+ rendering, the mesh can be created from the `forest` object by simply calling
211+ `Mesh (forest)` that will generate the 3D meshes and connect them to their
212212optical properties.
213213
214214However, we also want to add the soil surface as this will affect the light
215- distribution within the scene due to reflection from the soil surface. This is
216- similar to the customized scene that we created before for rendering, but now
215+ distribution within the mesh due to reflection from the soil surface. This is
216+ similar to the customized mesh that we created before for rendering, but now
217217for the light simulation.
218218
219219=#
@@ -225,29 +225,29 @@ function create_soil()
225225end
226226function create_scene (forest)
227227 # These are the trees
228- scene = Scene (vec (forest))
228+ mesh = Mesh (vec (forest))
229229 # Add a soil surface
230230 soil = create_soil ()
231231 soil_material = Lambertian (τ = 0.0 , ρ = 0.21 )
232- add! (scene, mesh = soil, materials = soil_material)
233- # Return the scene
234- return scene
232+ add! (mesh, soil, materials = soil_material)
233+ # Return the mesh
234+ return mesh
235235end
236236#=
237237
238- Given the scene , we can create the light sources that can approximate the solar
238+ Given the mesh , we can create the light sources that can approximate the solar
239239irradiance on a given day, location and time of the day using the functions from
240240the package (see package documentation for details). Given the latitude,
241241day of year and fraction of the day (`f = 0` being sunrise and `f = 1` being sunset),
242242the function `clear_sky()` computes the direct and diffuse solar radiation assuming
243243a clear sky. These values may be converted to different wavebands and units using
244244`waveband_conversion()`. Finally, the collection of light sources approximating
245245the solar irradiance distribution over the sky hemisphere is constructed with the
246- function `sky()` (this last step requires the 3D scene as input in order to place
246+ function `sky()` (this last step requires the 3D mesh as input in order to place
247247the light sources adequately).
248248
249249=#
250- function create_sky (;scene , lat = 52.0 * π/ 180.0 , DOY = 182 )
250+ function create_sky (;mesh , lat = 52.0 * π/ 180.0 , DOY = 182 )
251251 # Fraction of the day and day length
252252 fs = collect (0.1 : 0.1 : 0.9 )
253253 dec = declination (DOY)
@@ -264,7 +264,7 @@ function create_sky(;scene, lat = 52.0*π/180.0, DOY = 182)
264264 Idir_PAR = f_dir.* Idir
265265 Idif_PAR = f_dif.* Idif
266266 # Create the dome of diffuse light
267- dome = sky (scene ,
267+ dome = sky (mesh ,
268268 Idir = 0.0 , # # No direct solar radiation
269269 Idif = sum (Idir_PAR)/ 10 * DL, # # Daily Diffuse solar radiation
270270 nrays_dif = 1_000_000 , # # Total number of rays for diffuse solar radiation
@@ -274,20 +274,20 @@ function create_sky(;scene, lat = 52.0*π/180.0, DOY = 182)
274274 nphi = 12 ) # # Number of discretization steps in the azimuth angle
275275 # Add direct sources for different times of the day
276276 for I in Idir_PAR
277- push! (dome, sky (scene , Idir = I/ 10 * DL, nrays_dir = 100_000 , Idif = 0.0 )[1 ])
277+ push! (dome, sky (mesh , Idir = I/ 10 * DL, nrays_dir = 100_000 , Idif = 0.0 )[1 ])
278278 end
279279 return dome
280280end
281281#=
282282
283- The 3D scene and the light sources are then combined into a `RayTracer` object,
283+ The 3D mesh and the light sources are then combined into a `RayTracer` object,
284284together with general settings for the ray tracing simulation chosen via `RTSettings()`.
285285The most important settings refer to the Russian roulette system and the grid
286286cloner (see section on Ray Tracing for details). The settings for the Russian
287287roulette system include the number of times a ray will be traced
288288deterministically (`maxiter`) and the probability that a ray that exceeds `maxiter`
289289is terminated (`pkill`). The grid cloner is used to approximate an infinite canopy
290- by replicating the scene in the different directions (`nx` and `ny` being the
290+ by replicating the mesh in the different directions (`nx` and `ny` being the
291291number of replicates in each direction along the x and y axes, respectively). It
292292is also possible to turn on parallelization of the ray tracing simulation by
293293setting `parallel = true` (currently this uses Julia's builtin multithreading
@@ -296,26 +296,26 @@ capabilities).
296296In addition `RTSettings()`, an acceleration structure and a splitting rule can
297297be defined when creating the `RayTracer` object (see ray tracing documentation
298298for details). The acceleration structure allows speeding up the ray tracing
299- by avoiding testing all rays against all objects in the scene .
299+ by avoiding testing all rays against all objects in the mesh .
300300
301301=#
302- function create_raytracer (scene , sources)
302+ function create_raytracer (mesh , sources)
303303 settings = RTSettings (pkill = 0.9 , maxiter = 4 , nx = 5 , ny = 5 , parallel = true )
304- RayTracer (scene , sources, settings = settings, acceleration = BVH,
304+ RayTracer (mesh , sources, settings = settings, acceleration = BVH,
305305 rule = SAH {3} (5 , 10 ));
306306end
307307#=
308308
309309The actual ray tracing simulation is performed by calling the `trace!()` method
310310on the ray tracing object. This will trace all rays from all light sources and
311- update the radiant power absorbed by the different surfaces in the scene inside
311+ update the radiant power absorbed by the different surfaces in the mesh inside
312312the `Material` objects (see `feed!()` above):
313313
314314=#
315315function run_raytracer! (forest; DOY = 182 )
316- scene = create_scene (forest)
317- sources = create_sky (scene = scene , DOY = DOY)
318- rtobj = create_raytracer (scene , sources)
316+ mesh = create_scene (forest)
317+ sources = create_sky (mesh = mesh , DOY = DOY)
318+ rtobj = create_raytracer (mesh , sources)
319319 trace! (rtobj)
320320 return nothing
321321end
@@ -544,32 +544,33 @@ end
544544
545545As in the previous example, it makes sense to visualize the forest with a soil
546546tile beneath it. Unlike in the previous example, we will construct the soil tile
547- using a dedicated graph and generate a `Scene ` object which can later be
548- merged with the rest of scene generated in daily step:
547+ using a dedicated graph and generate a `Mesh ` object which can later be
548+ merged with the rest of mesh generated in daily step:
549549
550550=#
551551Base. @kwdef struct Soil <: VirtualPlantLab.Node
552552 length:: Float64
553553 width:: Float64
554554end
555555function VirtualPlantLab. feed! (turtle:: Turtle , s:: Soil , data)
556- Rectangle! (turtle, length = s. length, width = s. width, colors = RGB (255 / 255 , 236 / 255 , 179 / 255 ))
556+ Rectangle! (turtle, length = s. length, width = s. width, colors = RGB (255 / 255 , 236 / 255 , 179 / 255 ),
557+ materials = Lambertian (τ = 0.0 , ρ = 0.21 ))
557558end
558559soil_graph = RA (- 90.0 ) + T (Vec (0.0 , 10.0 , 0.0 )) + # # Moves into position
559560 Soil (length = 20.0 , width = 20.0 ) # # Draws the soil tile
560- soil = Scene (Graph (axiom = soil_graph));
561+ soil = Mesh (Graph (axiom = soil_graph));
561562render (soil, axes = false )
562563#=
563564
564- And the following function renders the entire scene (notice that we need to
565- use `display()` to force the rendering of the scene when called within a loop
565+ And the following function renders the entire mesh (notice that we need to
566+ use `display()` to force the rendering of the mesh when called within a loop
566567or a function):
567568
568569=#
569570function render_forest (forest, soil)
570- scene = Scene (vec (forest)) # # create scene from forest
571- scene = Scene ([scene , soil]) # # merges the two scenes
572- render (scene )
571+ mesh = Mesh (vec (forest)) # # create mesh from forest
572+ mesh = Mesh ([mesh , soil]) # # merges the two scenes
573+ render (mesh )
573574end
574575#=
575576
0 commit comments