Ask Your Question

using interact and canvas 3d

asked 2012-07-26 05:31:49 -0500

anonymous user


updated 2012-07-26 06:39:06 -0500

calc314 gravatar image

Hi, I'm not sure what I'm doing wrong but my code doesn't seem to be working. I have no errors when I run this code but the input box doesn't appear at all...

P = LatticePolytope([[1,2,3,4],[5,2,5,6],[2,2,5,2],[-3,-2,-5,-1],[-2,-2,-2,-1]])
from sage.geometry.polyhedron.plot import ProjectionFuncStereographic
def _(theta_one = slider(0,2*pi,pi/20, default = pi/4, label="theta_one"), 
      theta_two = slider(0,2*pi,pi/20, default = pi/4, label="theta_two"),
      phi = slider(0,2*pi,pi/20, default = pi/4, label="phi")): 

          proj = ProjectionFuncStereographic([a,b,c,d])
          projected_vertices = [proj(v) for v in P.vertices().columns()]
          faces = P.faces()[2]

          faces_as_vertex_lists = [[projected_vertices[n] for n in face.traverse_boundary()] for face in faces]
          scene = Graphics()
          for vert_list in faces_as_vertex_lists:
              scene = scene + polygon3d(vert_list, color='blue')

'canvas3d', axes=True)

def highlight_facet(facet_index = input_box(x, label="facet index")):
      facet_index = P.facets()[x]
      if facet_index == False:
          print "this facet does not exist"
      if facet_index == True:
          V = [projected_vertices(n) for n in facet_index]
          print V
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-07-26 06:44:47 -0500

calc314 gravatar image

updated 2012-07-26 07:08:03 -0500

I think you'll need to incorporate the input box into your first function definition with the sliders. Then, you can call your highlight_facet function (which should be defined prior to the first function) within this first function definition with the input facet_index.

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools


Asked: 2012-07-26 05:31:49 -0500

Seen: 137 times

Last updated: Jul 26 '12