1 | initial version |
Define the cube as a polyhedron (its a canned example):
sage: cube = polytopes.n_cube(3)
sage: cube.Hrepresentation()
(An inequality (0, 0, -1) x + 1 >= 0, An inequality (0, -1, 0) x + 1 >= 0, An inequality (-1, 0, 0) x + 1 >= 0, An inequality (1, 0, 0) x + 1 >= 0, An inequality (0, 0, 1) x + 1 >= 0, An inequality (0, 1, 0) x + 1 >= 0)
Define the plane as a polyhedron:
sage: plane = Polyhedron(eqns=[(0,1,0,0)])
sage: plane.Hrepresentation()
(An equation (1, 0, 0) x + 0 == 0,)
Compute the intersection:
sage: cube.intersection(plane)
A 2-dimensional polyhedron in QQ^3 defined as the convex hull of 4 vertices