Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Okay, what I think is going on here is that Polyhedron doesn't really play nice with other graphics methods. It's probably pretty old (for Sage) code that stems from a time before we had lots of nice 3d options - maybe?

So in particular, the way it renders vertices is also via point3d

return point3d(self.coordinates_of(self.points), **kwds)

so my somewhat educated guess is that since you are adding things to Z_set_as_graphics (itself a hack you shouldn't have to do, but that's another story), and since you defined that outside the interact, it is adding those points to itself. So the following works.

S = sphere(size=10,color="yellow",opacity=0.5) 
north_pole = point3d((0,0,10), color="blue") 
r = 10 
@interact 
def _(theta = slider(0,2*pi,pi/20, default = pi/3, label="theta"), phi = slider(0,2*pi,pi/20, default = pi/4, label="phi")): 
    point_of_projection = point3d((r*sin(theta)*cos(phi),r*sin(theta)*sin(phi),r*cos(theta)), color="red")
    Z = Polyhedron([[2,3,3],[3,0,3],[2,6,1],[1,0,1],[6,7,2]]) 
    Z_set_as_graphics = Z.plot() 
    show(Z_set_as_graphics + S + north_pole + point_of_projection)

Note that you could make many of the other things interactive too, and could probably even get the outputs to the sliders to LaTeX up nicely...