# Translucency lost after applying add_condition method

I need to render translucent implicit surfaces satisfying some additional constraints, such as, for example, the portion of the hyperboloid $x^2+y^2-z^2=1$ which is above the paraboloid $z=(x-1)^2+y^2-1$. The problem I found is that the opacity property is not preserved after applying the add_condition method. To be more concrete, the following code plots a gray, translucent hyperboloid:

var("x,y,z")
texture = dict(color="gray", opacity=0.6)
s = implicit_plot3d(x^2+y^2-z^2==1, (x,-3,3), (y,-3,3), (z,-2.5,2.5), **texture)
opts = dict(viewer="threejs", decimals=1)
s.show(**opts)


Let us apply the constraint:

s1 = s.add_condition(lambda x,y,z: z>(x-1)^2+y^2-1,10)
s1.show(**opts)


One gets a gray, but opaque, surface. Translucency is lost. I have found the following workaround:

from sage.plot.plot3d.index_face_set import IndexFaceSet
s2 = IndexFaceSet(s1.face_list(), **texture)
s2.show(**opts)


which yields the expected result. So I wonder if the loss of translucency is a bug. Anyway, is there a better workaround?

This Sagecell contains the above code.

edit retag close merge delete

I have been reading how to review tickets. But unfortunately things like using git or rebuilding code still scares me a lot. So, is there a simple way I could get the modified code to test it? It seems to me that a manual edit of the file src/sage/plot/plot3d/index_face_set.pyx is not the way to go.