Skip to content

Commit 759e4f8

Browse files
authored
Merge pull request #20 from VirtualPlantLab/revert-18-update_0.1.0
Revert "update primitives and raytraced forest to 0.1.0"
2 parents 1b09407 + fe0d003 commit 759e4f8

File tree

3 files changed

+42
-69
lines changed

3 files changed

+42
-69
lines changed

Project.toml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
name = "VPLDocs"
22
uuid = "19246b20-85cd-4f94-a989-28bb6828320f"
33
authors = ["Alejandro Morales Sierra <[email protected]> and contributors"]
4-
version = "0.1.0"
4+
version = "0.0.7"
55

66
[deps]
7-
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
87
Ecophys = "19467474-d12d-47c9-939f-3e50fbfd93ad"
9-
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
108
PlantGeomPrimitives = "7eef3cc5-4580-4ff0-8f6f-933507db6664"
119
PlantGeomTurtle = "7d6e2781-1c99-4c66-97ec-106669f3e96e"
1210
PlantGraphs = "615ad455-9aac-4340-9247-71ef610f781a"
1311
PlantRayTracer = "78485975-e4aa-407d-b3bb-ded5a4265d05"
1412
PlantSimEngine = "9a576370-710b-4269-adf9-4f603a9c6423"
1513
PlantViz = "358bd95d-d12c-439f-94b7-04b17e500c7f"
16-
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
1714
SkyDomes = "1838625c-7cf7-40c6-898b-904883e4b556"
1815
VirtualPlantLab = "b977ecfa-1b9a-418d-909d-4ebe565736ce"
1916

2017
[compat]
21-
Distributions = "0.25.120"
2218
Ecophys = "0.1.0"
23-
FastGaussQuadrature = "1.0.2"
24-
PlantGeomPrimitives = "0.1.0"
25-
PlantGeomTurtle = "0.1.0"
26-
PlantGraphs = "0.1.0"
27-
PlantRayTracer = "0.1.0"
19+
PlantGeomPrimitives = "0.0.5"
20+
PlantGeomTurtle = "0.0.6"
21+
PlantGraphs = "0.0.3"
22+
PlantRayTracer = "0.0.8"
2823
PlantSimEngine = "0.9"
29-
PlantViz = "0.1.0"
30-
Plots = "1.40.17"
31-
SkyDomes = "0.1.9"
32-
VirtualPlantLab = "0.1.0"
24+
PlantViz = "0.0.8"
25+
SkyDomes = "0.1.8"
26+
VirtualPlantLab = "0.0.7"
3327
julia = "1.11"

docs/src/manual/Geometry/Primitives.md

Lines changed: 25 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -39,115 +39,94 @@ to ensure that the transparency is enabled when rendering the mesh.
3939

4040
## Triangle
4141
```julia
42-
turtle = Turtle()
43-
p = Triangle!(turtle; length = 1.0, width = 1.0, colors = rand(RGBA))
44-
render(Mesh(turtle), wireframe = true)
42+
p = Triangle(length = 1.0, width = 1.0)
43+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
4544
```
4645

4746
## Rectangle
4847
```julia
49-
turtle = Turtle()
50-
p = Rectangle!(turtle; length = 1.0, width = 1.0, colors = rand(RGBA))
51-
render(Mesh(turtle), wireframe = true)
48+
p = Rectangle(length = 1.0, width = 1.0)
49+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
5250
```
5351

5452
## Trapezoid
5553
```julia
56-
turtle = Turtle()
57-
p = Trapezoid!(turtle; length = 1.0, width = 1.0, ratio = 0.5, colors = rand(RGBA))
58-
render(Mesh(turtle), wireframe = true)
54+
p = Trapezoid(length = 1.0, width = 1.0, ratio = 0.5)
55+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
5956
```
6057

6158
## Ellipse
6259
```julia
63-
turtle = Turtle()
64-
p = Ellipse!(turtle; length = 1.0, width = 1.0, n = 30, colors = rand(RGBA))
65-
render(Mesh(turtle), wireframe = true)
60+
p = Ellipse(length = 1.0, width = 1.0, n = 30)
61+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
6662
```
6763

6864
## Axis-aligned bounding box
6965
```julia
70-
turtle = Turtle()
7166
p = BBox(Vec(0.0, 0.0, 0.0), Vec(1.0, 1.0, 1.0))
72-
Mesh!(turtle, p, colors = rand(RGBA))
73-
render(Mesh(turtle), wireframe = true)
67+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
7468
```
7569

7670
## Cube
7771

7872
Solid version
7973

8074
```julia
81-
turtle = Turtle()
82-
p = SolidCube!(turtle; length = 1.0, width = 1.0, height = 1.0, colors = rand(RGBA))
83-
render(Mesh(turtle), wireframe = true)
75+
p = SolidCube(length = 1.0, width = 1.0, height = 1.0)
76+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
8477
```
8578

8679
Hollow version
8780

8881
```julia
89-
turtle = Turtle()
90-
p = HollowCube!(turtle; length = 1.0, width = 1.0, height = 1.0, colors = rand(RGBA))
91-
render(Mesh(turtle), wireframe = true)e)
82+
p = HollowCube(length = 1.0, width = 1.0, height = 1.0)
83+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
9284
```
9385

94-
95-
## Primitives with (semi-)circular bases
96-
97-
The following primitive types share a parameter n, which is the number of triangles to discretize the cylinder into.
98-
The lower is number n, cicle base shape will be more rough (e.g., n = 20, base shape is a pentagon).
99-
The higher is number n, cicle base shape will be more smooth (e.g., n = 80, base shape is a circle).
100-
10186
## Cylinder
10287

10388
Solid version
10489

10590
```julia
106-
turtle = Turtle()
107-
p = SolidCylinder!(turtle; length = 1.0, width = 1.0, height = 1.0, n = 80, colors = rand(RGBA))
108-
render(Mesh(turtle), wireframe = true)
91+
p = SolidCylinder(length = 1.0, width = 1.0, height = 1.0, n = 80)
92+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
10993
```
11094

11195
Hollow version
11296

11397
```julia
114-
turtle = Turtle()
115-
p = HollowCylinder!(turtle; length = 1.0, width = 1.0, height = 1.0, n = 80, colors = rand(RGBA))
116-
render(Mesh(turtle), wireframe = true)
98+
p = HollowCylinder(length = 1.0, width = 1.0, height = 1.0, n = 40)
99+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
117100
```
118101

119102
## Frustum
120103

121104
Solid version
122105

123106
```julia
124-
turtle = Turtle()
125-
p = SolidFrustum!(turtle; length = 1.0, width = 1.0, height = 1.0, ratio = 0.5, n = 80, colors = rand(RGBA))
126-
render(Mesh(turtle), wireframe = true)
107+
p = SolidFrustum(length = 1.0, width = 1.0, height = 1.0, ratio = 0.5, n = 80)
108+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
127109
```
128110

129111
Hollow version
130112

131113
```julia
132-
turtle = Turtle()
133-
p = HollowFrustum!(turtle; length = 1.0, width = 1.0, height = 1.0, ratio = 0.5, n = 80, colors = rand(RGBA))
134-
render(Mesh(turtle), wireframe = true)
114+
p = HollowFrustum(length = 1.0, width = 1.0, height = 1.0, ratio = 0.5, n = 40)
115+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
135116
```
136117

137118
## Cone
138119

139120
Solid version
140121

141122
```julia
142-
turtle = Turtle()
143-
p = SolidCone!(turtle; length = 1.0, width = 1.0, height = 1.0, n = 80, colors = rand(RGBA))
144-
render(Mesh(turtle), wireframe = true)
123+
p = SolidCone(length = 1.0, width = 1.0, height = 1.0, n = 40)
124+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
145125
```
146126

147127
Hollow version
148128

149129
```julia
150-
turtle = Turtle()
151-
p = HollowCone!(turtle; length = 1.0, width = 1.0, height = 1.0, n = 80, colors = rand(RGBA))
152-
render(Mesh(turtle), wireframe = true)
130+
p = HollowCone(length = 1.0, width = 1.0, height = 1.0, n = 20)
131+
render(p, wireframe = true, normals = true, color = RGBA(0,1,0,0.5), transparency = true)
153132
```

docs/src/tutorials/from_tree_forest/raytracedforest.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ function `sky()` (this last step requires the 3D scene as input in order to plac
247247
the light sources adequately).
248248

249249
```julia
250-
function create_sky(;mesh, lat = 52.0*π/180.0, DOY = 182)
250+
function create_sky(;scene, 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(;mesh, 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(mesh,
267+
dome = sky(scene,
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,7 +274,7 @@ function create_sky(;mesh, 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(mesh, Idir = I/10*DL, nrays_dir = 100_000, Idif = 0.0)[1])
277+
push!(dome, sky(scene, Idir = I/10*DL, nrays_dir = 100_000, Idif = 0.0)[1])
278278
end
279279
return dome
280280
end
@@ -299,9 +299,10 @@ for details). The acceleration structure allows speeding up the ray tracing
299299
by avoiding testing all rays against all objects in the scene.
300300

301301
```julia
302-
function create_raytracer(acc_mesh, sources)
302+
function create_raytracer(mesh, sources)
303303
settings = RTSettings(pkill = 0.9, maxiter = 4, nx = 5, ny = 5, parallel = true)
304-
RayTracer(acc_mesh, sources, settings = settings);
304+
RayTracer(mesh, sources, settings = settings, acceleration = BVH,
305+
rule = SAH{3}(5, 10));
305306
end
306307
```
307308

@@ -313,9 +314,8 @@ the `Material` objects (see `feed!()` above):
313314
```julia
314315
function run_raytracer!(forest; DOY = 182)
315316
mesh = create_scene(forest)
316-
acc_mesh = accelerate(mesh, acceleration = BVH, rule = SAH{3}(5, 10))
317-
sources = create_sky(mesh = acc_mesh, DOY = DOY)
318-
rtobj = create_raytracer(acc_mesh, sources)
317+
sources = create_sky(mesh = mesh, DOY = DOY)
318+
rtobj = create_raytracer(mesh, sources)
319319
trace!(rtobj)
320320
return nothing
321321
end
@@ -393,7 +393,7 @@ plot(0:1:50, x -> sink_strength(TreeTypes.Leaf(age = x), TreeTypes.treeparams())
393393
xlabel = "Age", ylabel = "Sink strength", label = "Leaf")
394394

395395
sink_strength(int) = pdf(int.sink, int.age)
396-
plot!(0:1:50, x -> sink_strength(TreeTypes.Internode(age = x)), label = "Internode")
396+
plot!(0:1:50, x -> sink_strength(TreeTypes.Leaf(age = x)), label = "Internode")
397397
```
398398

399399
Now we need a function that updates the biomass of the tree, allocates it to the

0 commit comments

Comments
 (0)