I am very new to Meshes.jl and getting a bit perplexed by all of it, since I cannot really find any good examples other than the quick examples, and I atleast cannot find what I want to do.
I have one single box element and I want to plot the normals on all the outer surfaces. Currently the code produces:
As you see I am missing 7 of them How do I loop over faces, and preferably in such a way the code would also work for 2D?
The code is here:
using Meshes using MeshViz using GLMakie using LinearAlgebra using Statistics grid = CartesianGrid(1,1,1) display(viz(grid , showfacets = true, alpha=0.25)) function ExtractMidpoints(p) o = p.vertices mp = mean(map(x->x.coords,o)) return mp end function GenerateGridNormal(p) o = p.vertices p1 = o p2 = o p3 = o v1 = p2 - p1 v2 = p3 - p1 n = cross(v1,v2) n /= norm(n) return n end mps = Tuple.(ExtractMidpoints.(grid)) nms = Tuple.(GenerateGridNormal.(grid)) scatter!(Tuple.(ExtractMidpoints.(grid))) arrows!(first.(mps),getindex.(mps,2),last.(mps),first.(nms),getindex.(nms,2),last.(nms))