Ask Your Question
3

Translucency lost after applying add_condition method

asked 2019-11-15 13:47:41 +0100

Juanjo gravatar image

updated 2019-11-15 16:38:09 +0100

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 flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
2

answered 2019-11-21 14:04:40 +0100

FrédéricC gravatar image

This is fixed by https://trac.sagemath.org/ticket/28783

Please help by revieweing this ticket.

edit flag offensive delete link more

Comments

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.

Juanjo gravatar imageJuanjo ( 2019-11-21 17:25:40 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-11-15 13:47:41 +0100

Seen: 302 times

Last updated: Nov 15 '19