Makie.jl recipes for visualization of Meshes.jl.
Get the latest stable release with Julia's package manager:
] add MeshViz
using Meshes, MeshViz
# choose a Makie backend
import GLMakie as Mke
using PlyIO: load_ply
function loadply(fname)
ply = load_ply(fname)
x = ply["vertex"]["x"]
y = ply["vertex"]["y"]
z = ply["vertex"]["z"]
points = Point.(x, y, z)
connec = [connect(Tuple(c.+1)) for c in ply["face"]["vertex_indices"]]
SimpleMesh(points, connec)
end
mesh = loadply("beethoven.ply")
viz(mesh, showfacets = true)
mesh = loadply("dragon.ply")
# for vertex coloring pass a vector of colors
# with the same length of the number of vertices
viz(mesh, color = 1:nvertices(mesh), colorscheme = :Spectral)
grid = CartesianGrid(10,10)
viz(grid, showfacets = true)
# for element coloring pass a vector of colors
# with the same length of the number of elements
viz(grid, color = 1:nelements(grid))
grid = CartesianGrid(10,10,10)
viz(grid, showfacets = true)
viz(grid, color = 1:nelements(grid))
using GeoTables
# Brazil states as Meshes.jl polygons
BRA = GeoTables.gadm("BRA", children = true)
viz(BRA.geometry, decimation = 0.02)
RIO = GeoTables.gadm("BRA", "Rio de Janeiro", children=true)
viz(RIO.geometry, decimation = 0.001)
viz(BRA.geometry, color = 1:length(BRA.geometry))
Please check the docstring ?viz
for available attributes.