I have a question about Makie, when plotting triangulated mesh surfaces is it possible to colour with flat coloured patches?
Compared to the example in: http://makie.juliaplots.org/stable/examples-mesh.html
I.e. the colour vector defines the colour of each triangles face and not each triangle’s edge points.
You can obtain flat coloured patches by a naive duplication of nodes to ensure that every triangle has different (eventually duplicated) vertices.
Do you have an example?
That seems like a hack. Sounds like something that should be easily implemented (if it isn’t already).
well this “hack” could be turned into a recipe
Does the problem start because the mesh objects don’t support per-face attributes? I’m not sure if that’s actually the case, but I remember reading this comment: https://github.com/JuliaIO/MeshIO.jl/blob/69b58518a5ea41ab56b8d87bcae8bff220b34c5c/src/io/stl.jl#L83
normals[i*3+1] = NormalType(normal...)
normals[i*3+2] = normals[i*3+1] # hurts, but we need per vertex normals
normals[i*3+3] = normals[i*3+1]
Any developments on this? I’m looking for the same feature right now.
I wrote some code to remove duplicate vertices from the meshes generated by Meshing.jl; now it seems like I have to implement the reverse operation?
The code is not complicated but I agree with @dpsanders, this should be a convenience method from the package
function _explode_vertices(vertices, faces)
new_vertices = similar(vertices, 0)
new_faces = similar(faces, 0)
for (i, face) in enumerate(faces)
for vertex in vertices[face]
push!(new_faces, Triangle(3i - 2:3i...))
return new_vertices, new_faces
newmesh = GLNormalMesh(_explode_vertices(oldmesh.vertices, oldmesh.faces)...)
feel free to upstream this code under current Meshing.jl license.