Ask Your Question

Revision history [back]

Assuming that your cones are compact, you can just use contaiment of all the vertices as follows

sage: def polyhedron_contains(P, Q):
....:     return all(P.contains(v) for v in Q.vertices())
sage: P1 = Polyhedron([(0,0,0), (3,0,0), (0,3,0), (0,0,3), (3,3,3)])
sage: P2 = Polyhedron( [(1,2,1), (1,0,0), (1,1,1), (1,1,2)])
polyhedron_contains(P1,P2)
True

Assuming that your cones are compact, only contains the vertex 0, you can just use contaiment of all the vertices as followsfollowing

sage: def polyhedron_contains(P, Q):
....:     return all(P.contains(v) for v in Q.vertices())
Q.rays())
sage: P1 = Polyhedron([(0,0,0), (3,0,0), (0,3,0), (0,0,3), (3,3,3)])
Polyhedron(rays = [(1,0,0), (0,1,0), (0,0,1)])
sage: P2 = Polyhedron( rays = [(1,2,1), (1,0,0), (1,1,1), (1,1,2)])
sage: polyhedron_contains(P1,P2)
True

Assuming that your cones only contains the vertex 0, you can just use contaiment the followingcontainment as follows

sage: def polyhedron_contains(P, Q):
....:     return all(P.contains(v) for v in Q.rays())
sage: P1 = Polyhedron(rays = [(1,0,0), (0,1,0), (0,0,1)])
sage: P2 = Polyhedron( rays Polyhedron(rays = [(1,2,1), (1,0,0), (1,1,1), (1,1,2)])
sage: polyhedron_contains(P1,P2)
True