Completely vertical polygons not showing with GLMakie poly!()

I’m trying to plot some polygons in 3D space with GLMakie and noticed that polygons that are complete vertical do not show up. Below is a script that plots a set of triangles where I drag one vertex along a line. Notice that the y = 0 triangle does not show up.

using GLMakie

lscene = LScene(fig[1, 1])
for y = -10 : 2 : 10
    poly!(Point3f[[0.0, 0.0, 5.0], [10.0, 0.0, 5.0], [10.0, y, 0.0]], shading = true)
end

wait(display(fig))

If instead I add a tiny offset to the y values, all the triangles are displayed.

using GLMakie

lscene = LScene(fig[1, 1])
for y = -10 : 2 : 10
    poly!(Point3f[[0.0, 0.0, 5.0], [10.0, 0.0, 5.0], [10.0, y+0.00001, 0.0]], shading = true)
end

wait(display(fig))

Is this a bug or am I missing something crucial?

1 Like

It’s a bug in how we mesh the polygons for display since it currently just takes the x and y coordinates, and ignores the z coordinate.

I have a way to make the triangulation live in the plane of the polygon in 3D (by finding the plane of best fit to the set of vertices of the polygon) here, which could be moved to Makie instead…what do you think @sdanisch?