-
-
Notifications
You must be signed in to change notification settings - Fork 361
Open
Labels
MakieBackend independent issues (Makie core)Backend independent issues (Makie core)conversionsMainly `convert_arguments`Mainly `convert_arguments`enhancementFeature requests and enhancementsFeature requests and enhancementsgood first issueThis should come with some instructions!This should come with some instructions!mesh(and poly)(and poly)
Description
It seems Makie assumes that a mesh should have triangular elements.
On the example below Makie (v0.5.1) works fine with triangular faces.
using GLMakie
u1 = LinRange(0, 2 * pi, 100) .* ones(100)'
v1 = LinRange(0, 2 * pi, 100)' .* ones(100)
u2 = cos.(u1) .* sin.(v1)
nl, nc = size(u1)
vertices = hcat(vec(u1), vec(v1), vec(u2))
v = collect(1:(nl-1))
faces = Matrix{Int64}(undef, (nl - 1) * (nc - 1), 3)
for c in 0:(nc-2)
for (index, vval) in enumerate(v)
faces[index+c*(nl-1), :] = [vval vval + 1 vval + nl + 1] .+ c * (nl)
end
end
msh = mesh(vertices, faces, color = vec(u2), shading = false, axis = (type=Axis3,))
wireframe!(msh.axis, msh.plot[1][], color = :black)If the triangular faces are replaced with quadrangular ones, Makie fails on a to_triangles. Is there a specific reason why ?
Code with quadrangular faces
using GLMakie
u1 = LinRange(0, 2 * pi, 100) .* ones(100)'
v1 = LinRange(0, 2 * pi, 100)' .* ones(100)
u2 = cos.(u1) .* sin.(v1)
nl, nc = size(u1)
vertices = hcat(vec(u1), vec(v1), vec(u2))
v = collect(1:(nl-1))
faces = Matrix{Int64}(undef, (nl - 1) * (nc - 1), 4)
for c in 0:(nc-2)
for (index, vval) in enumerate(v)
faces[index+c*(nl-1), :] = [vval vval + 1 vval + nl + 1 vval + nl] .+ c * (nl)
end
end
msh = mesh(vertices, faces, color = vec(u2), shading = false, axis = (type=Axis3,))
wireframe!(msh.axis, msh.plot[1][], color = :black)Metadata
Metadata
Assignees
Labels
MakieBackend independent issues (Makie core)Backend independent issues (Makie core)conversionsMainly `convert_arguments`Mainly `convert_arguments`enhancementFeature requests and enhancementsFeature requests and enhancementsgood first issueThis should come with some instructions!This should come with some instructions!mesh(and poly)(and poly)
