Added support for 3d surface meshes

This commit is contained in:
Josef Heinen 2021-08-22 09:17:42 +02:00
parent c67da7d7b8
commit 10802baf6e

View File

@ -1947,19 +1947,23 @@ function gr_draw_surface(series, x, y, z, clims)
e_kwargs = series[:extra_kwargs]
st = series[:seriestype]
if st === :surface
fillalpha = get_fillalpha(series)
fillcolor = get_fillcolor(series)
# NOTE: setting nx = 0 or ny = 0 disables GR.gridit interpolation
nx, ny = get(e_kwargs, :nx, 200), get(e_kwargs, :ny, 200)
if length(x) == length(y) == length(z) && nx > 0 && ny > 0
x, y, z = GR.gridit(x, y, z, nx, ny)
end
d_opt = get(e_kwargs, :display_option, GR.OPTION_COLORED_MESH)
if (!isnothing(fillalpha) && fillalpha < 1) || alpha(first(fillcolor)) < 1
gr_set_transparency(fillcolor, fillalpha)
GR.surface(x, y, z, d_opt)
if ndims(x) == ndims(y) == ndims(z) == 2
GR.gr3.surface(x', y', z, GR.OPTION_3D_MESH)
else
GR.gr3.surface(x, y, z, d_opt)
fillalpha = get_fillalpha(series)
fillcolor = get_fillcolor(series)
# NOTE: setting nx = 0 or ny = 0 disables GR.gridit interpolation
nx, ny = get(e_kwargs, :nx, 200), get(e_kwargs, :ny, 200)
if length(x) == length(y) == length(z) && nx > 0 && ny > 0
x, y, z = GR.gridit(x, y, z, nx, ny)
end
d_opt = get(e_kwargs, :display_option, GR.OPTION_COLORED_MESH)
if (!isnothing(fillalpha) && fillalpha < 1) || alpha(first(fillcolor)) < 1
gr_set_transparency(fillcolor, fillalpha)
GR.surface(x, y, z, d_opt)
else
GR.gr3.surface(x, y, z, d_opt)
end
end
elseif st === :wireframe
GR.setfillcolorind(0)