From 5f195ae6e131c7ce7329269f035d83061048ba6e Mon Sep 17 00:00:00 2001 From: t-bltg Date: Mon, 5 Jul 2021 11:48:48 +0200 Subject: [PATCH] add warning - enhance example --- src/backends/gr.jl | 29 +++++++++++++++-------------- src/examples.jl | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 74f11e6633..de2d549b61 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1863,6 +1863,7 @@ function gr_draw_surface(series, x, y, z, clims) GR.setfillcolorind(0) GR.surface(x, y, z, get(e_kwargs, :display_option, GR.OPTION_FILLED_MESH)) elseif st === :mesh3d + @warn "mesh3d support is experimental in GR" conn = series[:connections] if typeof(conn) <: Tuple{Array, Array, Array} ci, cj, ck = conn @@ -1872,25 +1873,25 @@ function gr_draw_surface(series, x, y, z, clims) else throw(ArgumentError("Argument connections has to be a tuple of three arrays.")) end - xx = zeros(eltype(x), 4length(ci)) - yy = zeros(eltype(y), 4length(cj)) - zz = zeros(eltype(z), 4length(ck)) + X = zeros(eltype(x), 4length(ci)) + Y = zeros(eltype(y), 4length(cj)) + Z = zeros(eltype(z), 4length(ck)) @inbounds for I ∈ 1:length(ci) i = ci[I] + 1 # connections are 0-based j = cj[I] + 1 k = ck[I] + 1 m = 4(I - 1) + 1; n = m + 1; o = m + 2; p = m + 3 - xx[m] = xx[p] = x[i] - yy[m] = yy[p] = y[i] - zz[m] = zz[p] = z[i] - xx[n] = x[j] - yy[n] = y[j] - zz[n] = z[j] - xx[o] = x[k] - yy[o] = y[k] - zz[o] = z[k] - end - GR.polyline3d(xx, yy, zz) + X[m] = X[p] = x[i] + Y[m] = Y[p] = y[i] + Z[m] = Z[p] = z[i] + X[n] = x[j] + Y[n] = y[j] + Z[n] = z[j] + X[o] = x[k] + Y[o] = y[k] + Z[o] = z[k] + end + GR.polyline3d(X, Y, Z) else throw(ArgumentError("Not handled !")) end diff --git a/src/examples.jl b/src/examples.jl index dd4eb8c466..1a280d80c3 100644 --- a/src/examples.jl +++ b/src/examples.jl @@ -1021,7 +1021,7 @@ const _examples = PlotExample[ k=[2, 3, 1, 3] # the four triangles gives above give a tetrahedron - mesh3d(x,y,z;connections=(i,j,k)) + mesh3d(x, y, z; connections=(i, j, k), title="triangles", legend=:none, margins=2Plots.mm) end ), ],