Skip to content

Commit

Permalink
Update index.md
Browse files Browse the repository at this point in the history
Color the 3d plot from the animation according to its vertices (better looking + nice example)
  • Loading branch information
VEZY committed Feb 17, 2022
1 parent 188e82a commit e2b0d7a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ opf = read_opf(joinpath(dirname(dirname(pathof(PlantGeom))),"test","files","simp
# First, we compute the 3D coordinates for each node in the MTG:
transform!(opf, refmesh_to_mesh!)
# And compute the max z of each node based on their mesh:
transform!(opf, zmax => :z, ignore_nothing = true)
transform!(opf, zmax => :z_node, ignore_nothing = true)
# Or the z coordinate of each vertez of each node mesh:
transform!(opf, :geometry => (x -> [i.coords[3] for i in x.mesh.points]) => :z_vertex, ignore_nothing = true)
# Then we make a Makie figure:
f = Figure()
Expand All @@ -35,17 +38,17 @@ ax2 = Axis3(gb[1, 1], aspect = :data, title = "3D representation (mesh)", elevat
hidedecorations!(ax2)
# We can make a diagram out of the MTG, and coloring using the z coordinates attribute:
diagram!(ax1, opf, color = :z)
diagram!(ax1, opf, color = :z_node)
hidedecorations!(ax1)
ax1.title = "MultiscaleTreeGraph diagram"
# And a 3d representation:
viz!(opf, color = :z)
viz!(opf, color = :z_vertex)
# And making a little animation out of it:
CairoMakie.record(f, "plant_animation.mp4", 1:120) do frame
ax2.azimuth[] = 1.7pi + 0.3 *sin(2pi* frame / 120)
ax2.azimuth[] = 0.3π + 0.3 * sin(* frame / 120)
end
```

Expand All @@ -60,7 +63,10 @@ opf = read_opf(joinpath(dirname(dirname(pathof(PlantGeom))),"test","files","simp
# First, we compute the 3D coordinates for each node in the MTG:
transform!(opf, refmesh_to_mesh!)
# And compute the max z of each node based on their mesh:
transform!(opf, zmax => :z, ignore_nothing = true)
transform!(opf, zmax => :z_node, ignore_nothing = true)
# Or the z coordinate of each vertez of each node mesh:
transform!(opf, :geometry => (x -> [i.coords[3] for i in x.mesh.points]) => :z_vertex, ignore_nothing = true)


# Then we make a Makie figure:
f = Figure()
Expand All @@ -72,16 +78,16 @@ ax2 = Axis3(gb[1, 1], aspect = :data, title = "3D representation (mesh)", elevat
hidedecorations!(ax2)

# We can make a diagram out of the MTG, and coloring using the z coordinates attribute:
diagram!(ax1, opf, color = :z)
diagram!(ax1, opf, color = :z_node)
hidedecorations!(ax1)
ax1.title = "MultiscaleTreeGraph diagram"

# And a 3d representation:

viz!(opf, color = :z)
viz!(opf, color = :z_vertex)

# And making a little animation out of it:
CairoMakie.record(f, "plant_animation.mp4", 1:120) do frame
ax2.azimuth[] = 1.7pi + 0.3 *sin(2pi* frame / 120)
ax2.azimuth[] = 0.3π + 0.3 * sin(2π * frame / 120)
end
```

2 comments on commit e2b0d7a

@VEZY
Copy link
Owner Author

@VEZY VEZY commented on e2b0d7a Feb 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/54853

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" e2b0d7a0db63b32d1b55aed661ccd8427c5b34a6
git push origin v0.1.0

Please sign in to comment.