I’m looking to use GR along with Interact.jl for a 3D visualization in IJulia, and I noticed that GR.trisurface
seems to have some difficulties with overlapping polygons (as matplotlib does).
Is there currently a way to achieve a ray-traced surface plot in Julia? I have been using Asymptote to render such figures statically, and it does a terrific job, but I would prefer a Julia-based solution.
import GR
GR.inline("png")
f(x,y) = x^2+y^2 < 1e-3 ? 0 : x*y/(x^2+y^2)
rad = 1
rv = linspace(0,rad,5)
θv = linspace(0,2π,12)
xv = [r*cos(θ) for r=rv, θ=θv]
yv = [r*sin(θ) for r=rv, θ=θv]
zv = [f(r*cos(θ),r*sin(θ)) for r=rv, θ=θv];
xv, yv, zv = map(a->vcat(a...),(xv,yv,zv))
GR.setviewport(0.1, 0.95, 0.1, 0.95)
GR.setwindow(-2, 2, -2, 2)
GR.setspace(-2, 2, 85, 35)
GR.setmarkersize(0.1)
GR.trisurface(xv,yv,zv)
GR.polyline3d([0,0],[0,0],[0,2])
GR.polyline3d([0,0],[0,2],[0,0])
GR.polyline3d([0,2],[0,0],[0,0])
GR.show()