Ask Your Question
2

show polyhedron in an interact

asked 2010-10-01 11:14:58 -0600

Philipp Schneider gravatar image

Hi, I am trying to write an interact which lets the user enter a list of vertices and then shows the corresponding polyhedron.

My first attempt is the following. The problem is that Sage does not show the polyhedron.

@interact
def _(t1=text_control("Polyhedron"), vertices="[[1,0],[0,1],[0,0]]"):
    p=Polyhedron(vertices=eval(vertices))
    show(p)

Does anybody know how to fix this?

Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2010-10-01 11:43:44 -0600

mhampton gravatar image

I don't completely understand why this is happening, but to work around it you can use the Polyhedron's projection method (the most flexible solution) or more simply the render_solid and render_wireframe methods. For example:

@interact
def _(t1=text_control("Polyhedron"), vertices="[[1,0],[0,1],[0,0]]"):
    p=Polyhedron(vertices=eval(vertices))
    show(p.render_solid(rgbcolor='green')+p.render_wireframe(rgbcolor='red'))
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

Stats

Asked: 2010-10-01 11:14:58 -0600

Seen: 127 times

Last updated: Oct 01 '10